Repository navigation
Conversation
Capture a logical session/conversation id from request headers (X-Session-ID, falling back to X-Correlation-ID) and thread it down to the Mooncake store worker so it can be used for session/cache-aware routing. - Frontend (Python + Rust): read the session header and stash it in sampling_params.extra_args["session_id"]. An explicit body value (vllm_xargs.session_id) is preserved and wins over the header. - Mooncake connector: carry session_id on RequestTracker/ReqMeta and populate it in build_connector_meta from the request. The id reaches ReqMeta in the worker; it is intentionally not attached to KV cache events for now. Signed-off-by: Zhewen Li <zhewenli@inferact.ai> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MAeYN3TSSMo7bxSP1ygRBj
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
8 of 10 tasks
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Lets the OpenAI-compatible frontend capture a logical session/conversation id from a request header and thread it down to the Mooncake store KV connector, so connectors can do session/cache-aware routing (e.g. co-locating a multi-turn conversation's prefixes).
Today a client can already pass arbitrary metadata via
vllm_xargs/extra_argsin the request body, but proxies/routers and benchmark clients commonly carry the session identity as an HTTP header (X-Session-ID/X-Correlation-ID), which vLLM currently drops. This PR reads that header and stashes it where connectors can see it.Flow:
X-Session-ID(falling back toX-Correlation-ID) →sampling_params.extra_args["session_id"]→ engineRequest→RequestTracker→ReqMeta(available to the Mooncake store worker).Changes
SESSION_ID_HEADERS+OpenAIServing._get_session_id; chat serving injects the captured id intosampling_params.extra_args["session_id"].X-Session-IDtakes precedence; an explicit bodyvllm_xargs.session_idis preserved and wins over the header.ResolvedRequestContext.session_idand inject viavllm_xargs(the same channelkv_transfer_paramsalready uses), so it arrives asextra_args["session_id"]on the engine side.session_idonRequestTracker/ReqMetaand populate it inbuild_connector_metafrom the request.Test plan & results
.venv/bin/python -m pytest tests/v1/kv_connector/unit/test_mooncake_store_scheduler.py tests/entrypoints/openai/chat_completion/test_serving_chat.py::test_serving_chat_session_id_header_extraction→ 17 passed (new tests: header capture + precedence,_session_id_from_requestedge cases,RequestTracker→ReqMetapropagation; existing scheduler tests still green).ruff check+ruff format --checkon all changed files → clean.cargo test -p vllm-server session→ 4 passed (header→vllm_xargsthreading,X-Session-IDprecedence, body-value wins, absent header);cargo fmt -p vllm-server --check→ clean;cargo build -p vllm-server→ ok.adding debug logs and verified data plumbed through aiperf -> router -> vllm
Notes
vllm-project/vllmPRs forX-Correlation-ID/X-Session-ID/ "session id header" — none plumb a session/correlation header intoextra_args/the KV connector.