Repository navigation
feat(loop): configurable session-affinity header names - #39
Merged
Merged
Conversation
bind_session_id and AgentLoopHooks gain header_names/session_header_names so a host can stamp its gateway's affinity header (e.g. X-Llmhub-Session) alongside or instead of x-upstream-session-id. Default unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Why
bind_session_idhardcodesx-upstream-session-id, a header the old EAS gateway used for session affinity. llm-hub, the company proxy most of our LLM traffic goes through, pins a session to one upstream key in its account pool using its own header,X-Llmhub-Session. Without that header, each turn of a conversation can land on a different key and miss the prompt cache: the same work takes several times longer and costs several times more. AgentCore should not know about llm-hub, so the header name becomes a setting the host supplies.What
bind_session_id(..., header_names=DEFAULT_SESSION_HEADER_NAMES): every name in the list gets the session id. An empty tuple sends nothing. A barestrraisesTypeError, because iterating it would send one header per character.AgentLoopHooks.session_header_names: sets the header names for the loop's built-in binding. Likesticky_session_enabled, it is ignored whenbind_sessionis supplied.DEFAULT_SESSION_HEADER_NAMESis exported. The default is unchanged, so this is fully backward compatible.skip-version-bumplabel. The change is additive: one new keyword with a default and one new hook field with a default.Consumer follow-up
ApodexHarness passes
("x-upstream-session-id", "X-Llmhub-Session")from its_bindadapter and hook wiring.Tests
str.extra_headers.🤖 Generated with Claude Code