Skip to content

[Refactor] Add an ordered context transformation plan to the existing IR - #3521

Open
ethanjyx wants to merge 7 commits into
vllm-project:mainfrom
ethanjyx:codex/context-transformation-plan
Open

[Refactor] Add an ordered context transformation plan to the existing IR#3521
ethanjyx wants to merge 7 commits into
vllm-project:mainfrom
ethanjyx:codex/context-transformation-plan

Conversation

@ethanjyx

@ethanjyx ethanjyx commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Closes #3472

Purpose

Give reset, exact deduplication, turn selection, and the existing block compressor one request-owned transformation plan. Policies receive detached views and propose edits; shared validation preserves protected messages, complete selected turns, tool-exchange membership, and retained message order before committing a step.

Extend the existing RequestIR and MessageIR with trusted provenance, eligibility, protection reasons, and stable turn/exchange identity. Capture original semantic history before RAG and Memory enrichment so later topic evidence can read an immutable snapshot. Route configured compression through the same plan and record bounded receipts without request text or arbitrary callback errors.

No public configuration or new policy is enabled. RAG still precedes Memory; configured tool-result text compression remains supported while non-text blocks and tool structure stay intact. Reset triggers, deduplication equivalence, ranking, summarization, and token budgeting remain separate work.

Owner: wg/agentic-context.

Test Plan

  • Run the contextcompression and protocolcodec suites, including the race detector.
  • Fuzz history-removal invariants and verify rejected edits never partially apply.
  • Verify byte-compatible disabled plans and transformed round trips for OpenAI Chat, Responses, and Anthropic.
  • Run request-pipeline tests with native libraries, repository lint, and the local image startup checks.

Test Result

Passed on commit 7513f43d857d692e1e5b650ab60e9b7e23e36b04:

  • make agent-validate.
  • SKIP_MODEL_DEPENDENT_TESTS=true make agent-ci-gate AGENT_CHANGED_FILES_PATH=/tmp/context-plan-changed-files: native Candle/ML/NLP builds, router build, baseline pre-commit, Go structural lint, structure and architecture checks, and 55 Go package test results, including the complete pkg/extproc, pkg/contextcompression, and pkg/protocolcodec suites.
  • go test -race ./pkg/contextcompression ./pkg/protocolcodec from src/semantic-router.
  • go test ./pkg/contextcompression -run '^$' -fuzz '^FuzzTransformationRemovalInvariants$' -fuzztime=10s -parallel=2 (61,889 executions).
  • Nine Linux request-pipeline tests in the final Dockerfile's go-builder image, with native Candle/ML/NLP libraries: original history capture, history selection without compression, tool-result compression, request controls, non-text preservation, RAG opt-in, neutral-request preparation, fail-closed handling, and recovery-tool name protection.
  • make vllm-sr-dev: both final router and dashboard images built successfully, including the frontend Vite build.
  • make agent-serve-local ENV=cpu AGENT_STACK_NAME=context-plan AGENT_PORT_OFFSET=400, then make agent-smoke-local with the same stack and offset: router, Envoy, and dashboard healthy.
  • A live request through Envoy and the router to a local mock backend selected smoke-model, preserved the system instruction and conversation history, and returned the backend response.
  • The feature-only test resolver reported no additional matching commands.

The Docker storage blockers are resolved after restoring host disk headroom and restarting Docker Desktop. Image-store reads, builds, network creation, and startup all completed without I/O errors. The temporary test stack and mock backend were stopped, and the test-only builder image was removed.

Validation scope: the core gate used the repository's supported SKIP_MODEL_DEPENDENT_TESTS=true option, excluding the model-dependent memory/tools package suites. External Milvus, Qdrant, Redis, Valkey, and Llama Stack test integrations retained the core gate's default skip settings. Model/GPU-dependent and Kubernetes E2E suites were not run. No public policy is enabled, so existing E2E coverage is retained for this internal refactor.


Semantic Router PR Checklist
  • PR title begins with exactly one bracketed category.
  • The PR links an accepted issue with exactly one Workgroup owner.
  • Commits are signed off.
  • Test results reflect completed validation and the remaining blockers.

Give history policies a request-owned plan that validates proposed edits before mutation, retains protected content and tool exchanges, and records bounded receipts. Preserve pre-enrichment history and integrate configured block compression without enabling new policies.

Signed-off-by: Ethan Jiang <ethanjyx@umich.edu>
@netlify

netlify Bot commented Sep 5, 2026

Copy link
Copy Markdown

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 66f028f
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/6a9f073b0b6adc0008bb4f96
😎 Deploy Preview https://deploy-preview-3521--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added pr/needs-author Waiting for author changes or response. wg/agentic-context Owned by the Agentic and Context Workgroup. labels Sep 6, 2026

@Xunzhuo Xunzhuo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting the shared seam in place. The request-owned plan validates the complete step order before mutation, gives policies detached views, preserves complete turns and tool exchanges, and routes the existing compressor through the final commit stage. I do not see a code blocker in this draft. Please rebase onto current main and mark it ready when you want the final approval pass.

@ethanjyx

ethanjyx commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@Xunzhuo updated

@github-actions github-actions Bot added pr/needs-review Ready for reviewer attention. and removed pr/needs-author Waiting for author changes or response. labels Sep 6, 2026
Xunzhuo
Xunzhuo previously approved these changes Sep 6, 2026

@Xunzhuo Xunzhuo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this out of draft. The rebased head is patch-equivalent to the reviewed transformation-plan implementation, the history and protected-turn invariants remain intact, and the latest exact-head checks are green. Approved.

@mergify

mergify Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@github-actions github-actions Bot added pr/blocked Blocked on a named decision, dependency, or required check. and removed pr/needs-review Ready for reviewer attention. labels Sep 7, 2026
@ethanjyx

ethanjyx commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

queue

☑️ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission >= write

@github-actions github-actions Bot added pr/merge-ready Approved and passing required checks. and removed pr/blocked Blocked on a named decision, dependency, or required check. labels Sep 7, 2026
@github-actions github-actions Bot removed the pr/merge-ready Approved and passing required checks. label Sep 7, 2026
@github-actions github-actions Bot added the pr/needs-rebase Needs rebase or conflict resolution. label Sep 7, 2026
wilsonwu
wilsonwu previously approved these changes Sep 7, 2026

@wilsonwu wilsonwu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-09-07 07:49 UTC · Rule: default · triggered by @wilsonwu with the merge queue checkbox
  • 🚫 Left the queue2026-09-07 08:11 UTC · at faca2402f33b93417305785d7d9b5ae7da945a3e

This pull request spent 22 minutes 26 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/ci-changes.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@github-actions github-actions Bot added pr/blocked Blocked on a named decision, dependency, or required check. and removed pr/needs-rebase Needs rebase or conflict resolution. labels Sep 7, 2026
@ethanjyx
ethanjyx dismissed stale reviews from wilsonwu and Xunzhuo via 66f028f September 7, 2026 18:49
@github-actions github-actions Bot added pr/needs-review Ready for reviewer attention. and removed pr/blocked Blocked on a named decision, dependency, or required check. labels Sep 7, 2026
@ethanjyx

ethanjyx commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@wilsonwu @Xunzhuo can you approve again ? I rebased.

@ethanjyx
ethanjyx requested review from Xunzhuo and wilsonwu September 7, 2026 21:13
@github-actions github-actions Bot added pr/needs-rebase Needs rebase or conflict resolution. and removed pr/needs-review Ready for reviewer attention. labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/needs-rebase Needs rebase or conflict resolution. wg/agentic-context Owned by the Agentic and Context Workgroup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Define an ordered context-transformation plan and protected-turn IR

3 participants