Skip to content

feat(routing): opt-in X-Dynamo-Session-ID header from correlation ID - #19

Merged
cquil11 merged 1 commit into
cquil11/aiperf-agentx-v1.0from
cquil11/reopen-dynamo-session-headers
Jul 21, 2026
Merged

feat(routing): opt-in X-Dynamo-Session-ID header from correlation ID#19
cquil11 merged 1 commit into
cquil11/aiperf-agentx-v1.0from
cquil11/reopen-dynamo-session-headers

Conversation

@cquil11

@cquil11 cquil11 commented Jul 21, 2026

Copy link
Copy Markdown

Reopens the change from the original PR: #17

The original merge was reverted in #18. This PR reapplies the exact same patch.

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-Key keyed off x_correlation_id). One new flag, one header block — no plugin machinery.

Set AIPERF_HTTP_X_DYNAMO_SESSION_ID_FROM_CORRELATION_ID=true and every request carries:

  • X-Dynamo-Session-ID = the stable x_correlation_id (same on every turn of a session)
  • X-Dynamo-Parent-Session-ID = the parent session's ID, only on subagent children

Pair with a Dynamo frontend running --router-session-affinity-ttl-secs to pin every turn of a session to the replica holding its KV prefix. Semantics match PR #15's dynamo_headers mode; this is the minimal header-only slice, not the full session_routing plugin layer.

Changes

  • environment.py — new X_DYNAMO_SESSION_ID_FROM_CORRELATION_ID bool (default False).
  • base_transports.py — emit the two headers in build_headers, parent only when parent_correlation_id is 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-A spawns child-A1/child-A2) run through aiperf profile against the in-repo mock server with --export-level raw. Raw-export request_headers is the exact dict handed to aiohttp session.post(headers=...); every request returned 200.

  • Flag ON: roots carry X-Dynamo-Session-ID (own corr) and no parent header; children carry both, with X-Dynamo-Parent-Session-ID equal to a real root correlation ID.
  • Flag OFF (control): zero X-Dynamo-* headers across all records.
  • Unit: tests/unit/transports/test_base_transport.py 29/29 pass.

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@ed2e040d0ed0976bbf632e5095d0b1ccebf8f6a2

Recommended 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@ed2e040d0ed0976bbf632e5095d0b1ccebf8f6a2

Last updated for commit: ed2e040Browse code

@github-actions

Copy link
Copy Markdown

Fern Docs Preview: generation failed — see the Actions log for details. This does not block merge; ask a maintainer to retry if needed.

@cquil11

cquil11 commented Jul 21, 2026

Copy link
Copy Markdown
Author

For agentic submissions as you know, we are using fork of aiperf. There are PRs such as this one https://github.com/SemiAnalysisAI/aiperf/pull/17  to support infrastructure for Dynamo specific headers. We encourage AMD to open PRs of the same like as this is a vendor agnostic benchmark harness. Thank you

@andyluo7 @chunfangamd

please review

@andyluo7

Copy link
Copy Markdown

@cquil11 , LGTM

@cquil11
cquil11 merged commit 6557924 into cquil11/aiperf-agentx-v1.0 Jul 21, 2026
9 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants