Repository navigation
feat(llm): preserve opaque coding-agent headers - #15367
ishandhanani merged 9 commits into
Conversation
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
๐ฟ Fern Docs Preview: https://nvidia-preview-01a0f008-6535-72fa-b37b-063d24060130.docs.buildwithfern.com/dynamo/dev |
|
/ok to test ce5a8fd |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. ๐ โน๏ธ Recent review infoโ๏ธ Run configurationConfiguration used: Repository: ai-dynamo/dynamo/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ๐ Files selected for processing (15)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe change replaces parsed compaction metadata with captured raw agent headers. It preserves selected header values in agent context, forwards them to worker-selection session context, and documents how plugins access and interpret them. ChangesAgent header capture and access
Priority: โฌ๏ธ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: โช Minimal ยท up to The header-capture change has no identified merge-blocking issue after normal checks. ๐ฅ Pre-merge checks | โ 3 | โ 1 | โ 1โ Failed checks (1 warning, 1 inconclusive)
โ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 10 files. (5 skipped: 4 unsupported, 1 too large.) Full details: Description checkExplanation The description provides substantial technical context and validation results, but it does not follow the required template. It omits the Overview, Details, Where should the reviewer start?, and required Related Issues sections. Resolution Add the required template sections. Complete the Related Issues section by linking the relevant issue or checking the confirmation that no related issue exists. Add reviewer starting points and organize the summary and validation details under the required headings.
Comment |
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test 2c8ec38 |
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test dd28ded |
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test e188692 |
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: The public
AgentCompactiontype andAgentContext::compactionfield remain removed atdynamo-llm1.6.0. Downstream users importing the type or constructing the public context with that field will still fail to compile, and legacy normalized compaction is discarded rather than forwarded. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield remain removed. Existing downstream Rust users constructingAgentContext, using its builder, or importingAgentCompactionwill fail to compile, while older wire payloads silently lose normalized compaction metadata. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield remain removed from the publicdynamo_llm::protocols::common::extensionsAPI while the workspace version is still 1.6.0. Downstream users importing the type or constructing/accessing this field fail to compile, and existing callers lose the normalized value. Restore the legacy API during the compatibility window and carryagent_headersadditively.
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield are removed whiledynamo-llmremains at version 1.6.0. Downstream users importing the type or constructing/accessing that field will fail to compile, and old normalized compaction metadata is discarded. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield are removed while the workspace remains at version 1.6.0. Downstream Rust users importing the type or constructing/accessing that field will fail to compile, and legacy wire payloads silently discard normalized compaction metadata. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield remain removed while the workspace version is 1.6.0, breaking downstream users of that public API and dropping normalized legacy compaction data. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield remain removed whiledynamo-llmis version 1.6.0. Downstream Rust users importing the type or constructing/accessing that field will fail to compile, and older wire payloads discard normalized compaction metadata.
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test 6b2c63d |
jthomson04
left a comment
There was a problem hiding this comment.
Source-only review of 6b2c63d, including the latest documentation changes. No blocking findings. The boolean helper naming suggestion is non-blocking. Tests and CI results were not checked.
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield are removed whiledynamo-llmremains at version 1.6.0. Downstream users importing the type or constructing/accessing that field will fail to compile, and legacy normalized compaction metadata is discarded. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield remain removed while the workspace version is still 1.6.0, so downstream Rust users importing the type or constructing/accessing that field will fail to compile, and legacy normalized compaction payloads are discarded. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield were removed while the workspace remains at version 1.6.0. Downstream Rust consumers importing the type or constructing/accessing that field will fail to compile, and legacy normalized compaction data is deserialized then discarded. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield are removed whiledynamo-llmremains at version 1.6.0. Downstream Rust users importing, constructing, or accessing that API will fail to compile, and legacy normalized compaction data is discarded by new readers. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield remain removed whiledynamo-llmis version 1.6.0, breaking downstream users of that public API and discarding normalized legacy compaction data.
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test 6c101c5 |
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield remain removed whiledynamo-llmis version 1.6.0. Downstream Rust users importing, constructing, or accessing this API will fail to compile, and legacy normalized compaction payloads are accepted then discarded. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield are removed whiledynamo-llmremains at version 1.6.0. Downstream Rust users importing, constructing, or accessing this API will fail to compile, and legacy normalized compaction payloads are deserialized then discarded. - Original discussion: Verified still present: the public
AgentCompactiontype andAgentContext::compactionfield are removed while the workspace remains at version 1.6.0. Downstream Rust users importing, constructing, or accessing this API will fail to compile, and legacy normalized compaction payloads are deserialized then discarded.
|
/ok to test 57cd701 |
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: The
SessionContext::agent_headersrustdoc still duplicates ingress capture limits and interpretation details already documented onAgentContext.agent_headersand in the agent-header documentation. It should retain only the worker-selection-specific contract: plugins receive opaque observations and the default policy does not interpret them. - Original discussion: Verified still present in
lib/llm/src/protocols/agents.rs: the extrax-claude-code-compaction,x-claude-code-context-compacted, andx-claude-code-prompt-idexamples still take the same open-family capture path already covered by the retained repeated/emptyx-claude-code-futureand verbatim percent-encoded header cases. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield are removed whiledynamo-llmremains at version 1.6.0. Downstream Rust users importing the type or constructing/accessing the field will fail to compile, and legacy normalized compaction payloads are accepted then discarded. - Original discussion: Verified still present:
AgentCompactionand the publicAgentContext::compactionfield remain removed whiledynamo-llmis version 1.6.0. Downstream Rust users importing, constructing, or accessing this public API will fail to compile, and legacy normalized compaction payloads are accepted then discarded. - Original discussion:
AgentCompactionand the publicAgentContext::compactionfield remain removed whiledynamo-llmis version 1.6.0. Downstream code importing the type or constructing/accessing the field will fail to compile, and old wire payloads silently lose normalized compaction data.
Live validation and Perfetto traces
Real Claude Code 2.1.285 and Codex 0.159.1 sessions exercised tool calls, subagents, manual compaction, and post-compaction requests. All 143 eligible header values across 35 successful inference requests matched the saved Dynamo envelopes exactly.
Download either JSON and open it in Perfetto. Click an outer request slice to inspect
agent_context.agent_headers. Both files are also available in this gist. The persistent installation ID is redacted in the shared files.These exports include display-only harness/compaction/window labels from a run-local formatter; those labels are not runtime normalization and are not added by this PR. Tool bars inferred by the existing converter are not measured host tool execution. Codex ran with apps and built-in web search disabled; three initial compatibility failures are excluded from the successful-request counts. This is functional validation, not a performance comparison.
The stock Perfetto converter now preserves the complete raw
agent_contexton request slices and actual tool events. All 11 converter self-checks pass, and a stock conversion of the saved run retains all 143 header values. Targeted pre-commit checks and Python compilation pass.Summary
Carry coding-agent headers as opaque observations in the existing
AgentContext, instead of defining cross-agent invocation or compaction semantics in Dynamo. Claude Code's gateway protocol makes header names and values open lists; new hints should not require an envelope schema change.AgentCompactionwithagent_headers, a map of lowercase wire names to ordered string arrays. Capture the openx-claude-code-*andx-codex-*families plus existing session/subagent compatibility headers. Preserve unknown values, repeated values, empty strings, percent encoding, and embedded JSON without parsing.SessionContext.agent_headers(); share strings across in-process clones.flowchart LR H[HTTP headers] --> A[AgentContext: typed identity + raw headers] A --> P[Preprocessing and worker wire] A --> T[Request traces] P --> S[Plugin SessionContext.agent_headers]Capture requires an existing recognized session identity. Bounds are 64 values, 16 KiB per value, and 32 KiB total including names. Sensitive-marked, non-text, and over-budget values are omitted whole; unrelated authentication and protocol headers are not captured. These are untrusted observations, not a transparent HTTP relay or request-body metadata store.
Old wire readers ignore the new map; new readers tolerate the old optional
compactionfield. Trace consumers that used normalized compaction must now interpret native headers. Older frontends cannot provide the new map during rolling upgrades. The RustAgentCompactiontype is removed.Validation
cargo test -p dynamo-llm --lib --no-default-features agent_context: 23 passed, including both wire-compatibility directions, preprocessing, and trace propagation.cargo check -p dynamo-llm --lib --no-default-features,cargo clippy -p dynamo-llm -p dynamo-kv-router --lib --tests --no-default-features -- -D warnings,cargo fmt --all --check, andgit diff --checkpassed.deepseek-v4-pro-0813.mdxrecipe.cargo bench -p dynamo-kv-router --features bench --bench worker_selection -- 'custom_worker_selection/10_000' --noplot: optimized benchmark completed, 50 samples per case. Point estimates: 647.38 us without the filter, 874.61 us with the keep-all filter. Existing fixture has no session metadata; this is a selection-path smoke check, not a before/after or header-capture performance claim.Summary by CodeRabbit