Repository navigation
docs: specify server-managed prompt cache state for Messages - #195
Draft
franciscojavierarceo wants to merge 2 commits into
Draft
franciscojavierarceo wants to merge 2 commits into
franciscojavierarceo wants to merge 2 commits into
Conversation
Signed-off-by: Francisco Javier Arceo <[email protected]>
Signed-off-by: Francisco Javier Arceo <[email protected]>
This was referenced Aug 21, 2026
9 tasks
maralbahari
added a commit
that referenced
this pull request
Nov 18, 2026
## Summary Closes #159, as proposed in my comment there. #360 and #364 build on it. `/v1/messages` and `/v1/messages/count_tokens` now read every `x-claude-code-session-id` and `X-Session-ID` value and forward one gateway-derived `X-Session-ID`, which vLLM reads as the request's session id. Before this change the client's `X-Session-ID` reached vLLM unchanged, with no tenant scope and no check against `x-claude-code-session-id`. - One value, or equal values, give one session id. Empty values count as absent. With no value, no `X-Session-ID` is forwarded. - Tenant: the verified OIDC principal (issuer and subject) when OIDC is on, otherwise the default tenant. No client header picks it (#107). - `x-claude-code-session-id`, the other headers and the body pass through unchanged. All Messages paths forward the handler's headers, so `proxy.rs` and the executor are not touched. - With neither header, a non-empty `vllm_xargs.session_id` string in the body is scoped into `X-Session-ID` the same way. The body is forwarded unchanged, and vLLM prefers the header. - A `Connection` header that lists either session header gets the same 400: forwarding drops the headers it lists, the derived one included. Two decisions from my comment, with the defaults I chose. Either is a small change if you prefer the other. 1. Scoping format: lowercase hex SHA-256 over length-prefixed fields (a version tag, tenant, client id), in `ScopedSessionId::new`. Fixed length, and the OIDC subject does not reach vLLM. A readable `{tenant}:{session}` prefix would replace only that function and its known-answer tests; the keyed HMAC in #195 also needs a key setting. 2. Conflicts: different values (across the two headers, or a repeated `X-Session-ID`), non-ASCII values and values over 256 bytes return 400 `invalid_request_error` before any upstream call. Preferring `x-claude-code-session-id` instead is one branch in `session_identity.rs` plus the conflict test cases. ## Test Plan - Unit: the derivation (known-answer vectors checked with Python `hashlib`, tenant separation, field boundaries), the header parsing (every case above, 256/257 bytes) and the body fallback. - `messages_test.rs`: forwarding on every path, including `count_tokens`, and the 400s on the proxy, gateway-loop, streaming-loop and `count_tokens` paths with no upstream request. `oidc_auth_test.rs`: two principals with the same client id get different values; one principal keeps its value. - Before the review fix, the `Connection` cases got 200 and the body case forwarded no `X-Session-ID`. Now `messages_test` 18/18 and `oidc_auth_test` 23/23 pass. - `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test` and `pre-commit run --all-files` pass. --------- Signed-off-by: sohomchakraborty <[email protected]> Signed-off-by: Sohom Chakraborty <[email protected]> Co-authored-by: Maral <[email protected]>
This branch has not been deployed
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.
Summary
Test Plan