feat(routing): opt-in X-Dynamo-Session-ID header from correlation ID#17
Open
ajcasagrande wants to merge 1 commit into
Conversation
Add AIPERF_HTTP_X_DYNAMO_SESSION_ID_FROM_CORRELATION_ID, following the existing X-Session-ID / X-SMG-Routing-Key env-toggle precedent in base_transports. When set, every request carries X-Dynamo-Session-ID (the stable x_correlation_id), plus X-Dynamo-Parent-Session-ID on subagent children, so a Dynamo frontend running --router-session-affinity-ttl-secs pins every turn of a session to the replica holding its KV prefix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anthony Casagrande <acasagrande@nvidia.com>
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@d14531b4a83e987c2477e82227ae2fd5184be755Recommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@d14531b4a83e987c2477e82227ae2fd5184be755Last updated for commit: |
ishandhanani
approved these changes
Jul 16, 2026
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
Bare-minimum enablement for Dynamo session-header affinity, following the existing env-toggle precedent already in
base_transports(X-Session-ID,X-SMG-Routing-Keykeyed offx_correlation_id). One new flag, one header block — no plugin machinery.Set
AIPERF_HTTP_X_DYNAMO_SESSION_ID_FROM_CORRELATION_ID=trueand every request carries:X-Dynamo-Session-ID= the stablex_correlation_id(same on every turn of a session)X-Dynamo-Parent-Session-ID= the parent session's ID, only on subagent childrenPair with a Dynamo frontend running
--router-session-affinity-ttl-secsto pin every turn of a session to the replica holding its KV prefix. Semantics match PR #15'sdynamo_headersmode; this is the minimal header-only slice, not the fullsession_routingplugin layer.Changes
environment.py— newX_DYNAMO_SESSION_ID_FROM_CORRELATION_IDbool (defaultFalse).base_transports.py— emit the two headers inbuild_headers, parent only whenparent_correlation_idis set.test_base_transport.py— two tests mirroring the existing SMG/session-id toggle tests (root has no parent header; child adds it).docs/environment-variables.md— regenerated.Verification (over the wire)
Custom spawn
dag_jsonl(root-Aspawnschild-A1/child-A2) run throughaiperf profileagainst the in-repo mock server with--export-level raw. Raw-exportrequest_headersis the exact dict handed to aiohttpsession.post(headers=...); every request returned 200.X-Dynamo-Session-ID(own corr) and no parent header; children carry both, withX-Dynamo-Parent-Session-IDequal to a real root correlation ID.X-Dynamo-*headers across all records.tests/unit/transports/test_base_transport.py29/29 pass.🤖 Generated with Claude Code