fix(worker): add Dynamo session control for replay sessions#5
Open
weireweire wants to merge 2 commits into
Open
Conversation
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@8c9067d0bd8d13161606b2ab59307f896b82ae99Recommended 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@8c9067d0bd8d13161606b2ab59307f896b82ae99Last updated for commit: |
ae553d4 to
6d62c91
Compare
6d62c91 to
948925a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 948925a. Configure here.
d47d1a9 to
4bf761e
Compare
4bf761e to
8c9067d
Compare
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
nvext.session_controlX-Correlation-IDasnvext.session_control.session_idValidation
PYTHONPATH=tests uv run --with pytest-asyncio pytest tests/unit/common/config/test_endpoint_config.py tests/unit/common/models/test_endpoint_info.py tests/unit/credit/test_issuer.py tests/unit/credit/test_structs.py tests/unit/timing/strategies/test_agentic_replay.py tests/unit/timing/test_branch_orchestrator_pre_session.py tests/unit/workers/test_worker.py tests/unit/workers/test_worker_cache_bust_injection.py tests/unit/workers/test_worker_cache_bust_adversarial.py -q(186 passed)uv run --with 'ruff>=0.14.0,<0.15.0' ruff check src/aiperf/workers/worker.py tests/unit/workers/test_worker.py\nNote
Medium Risk
When routing is enabled, every outbound request body gains merged
nvextmetadata; cache-bust semantics changed for FIRST_TURN and repeated injection, which can alter KV-cache behavior in benchmarks.Overview
Adds opt-in Dynamo conversation-aware routing via endpoint flags that emit
nvext.session_controlon OpenAI-compatible request bodies, with configurable session timeout (default 300s). Config flows from CLI/EndpointConfiginto runtimeEndpointInfo.When enabled, the worker merges
session_controlinto the last turn’sextra_body,raw_payload, or decodedpayload_bytes, usingcredit.x_correlation_idassession_idand sendingaction: bindonly on the first request per worker for that session (tracked in_dynamo_bound_session_ids).Cache-bust fixes: marker injection is idempotent (skips if content already contains the marker), and
FIRST_TURN_*targets apply to the seeded first user turn even when credits resume atturn_index > 0(agentic replay), without duplicating markers on repeated_apply_cache_bustcalls.Reviewed by Cursor Bugbot for commit 8c9067d. Bugbot is set up for automated code reviews on this repo. Configure here.