Repository navigation
fix(gateway): Send the conversation ID as the AI Gateway session ID - #2590
Merged
Merged
Conversation
Co-Authored-By: Thomas Jiang <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
4 screenshot changes — 4 changed · 0 added · 0 removed Review screenshots in Frameshift
|
thomasjiangcy
approved these changes
Nov 3, 2026
sentry-junior Bot
added a commit
that referenced
this pull request
Nov 8, 2026
The agent sends its Conversation ID as x-session-affinity (#2590), but warmups went through completeText with no session ID. Pass the same session ID, so a warmup reaches the same gateway session as the request that it refreshes. Co-Authored-By: BYK <[email protected]>
This branch was successfully 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.
Junior sends no session ID to AI Gateway. The gateway then groups requests by a fingerprint of the system prompt, tools, and first user message, so many Conversations land in one session. In production, one gateway session (
c4324a46b68384ee1ed53430177616b2) held about 2,000 requests over 6 hours from many Conversations.The agent now passes its Conversation ID to Pi as
sessionId.resolveGatewayModelenables Pi'ssendSessionAffinityHeaderson every gateway model, so Pi sends it asx-session-affinity, which the gateway reads as an explicit session ID. Every gateway model in Pi's catalog and in our overrides usesanthropic-messages, so one flag covers all of them. DirectcompleteTextcalls pass nosessionId, so they still send no header. A child agent has its own Conversation ID and gets its own session.Conversation IDs are opaque (
slack:<channel>:<ts>, hashedagent:/local:IDs) and already go into telemetry, so they are sent as-is, not hashed.The model message history integration test now checks that every request over two Turns carries the Conversation ID in
x-session-affinity. It fails onmainwith[null, null, null].--
View Session [Sentry]