Repository navigation
Persist provider-observed complete-turn usage - #411
GraciousGazelles wants to merge 19 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces provider-observed sub-agent completion receipts and turn-scoped response usage aggregation. It adds an optional provider_usage field to TurnCompleteEvent to track element-wise token usage aggregates from successful provider completions, updating sampling, local compaction, and remote-v2 compaction to contribute to this aggregate. Additionally, MultiAgentV2 child completions now forward a bounded, runtime-authored <completion_provider_receipt> before the payload. Feedback on the changes suggests avoiding a potential panic by replacing an unreachable! macro with a defensive fallback when handling unexpected event variants, and optimizing the XML escaping function bounded_xml_value by pre-allocating string capacity and using a for loop instead of fold.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Code Review
This pull request introduces provider-observed sub-agent completion receipts and turn-scoped response usage aggregation. It adds an optional provider_usage field to TurnCompleteEvent to aggregate exact provider-reported token usage across successful response completions (including sampling and compaction) in a turn. Additionally, MultiAgentV2 child completions now forward a bounded, runtime-authored <completion_provider_receipt> containing terminal response identity and turn usage before the child-controlled payload. Feedback on the changes points out a potential compilation issue in TurnContext::record_provider_usage where add_assign is used on TokenUsage without ensuring the AddAssign trait is imported or implemented, and suggests performing the element-wise addition manually.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
caef870 to
1ffda75
Compare
c813b4b to
8c80eb5
Compare
|
Closing this current-main candidate as infrastructure-blocked after three exact-head hosted retries. The source-level compile, argument-comment lint, CodeQL, smoke, release, and heavy checks passed; the only blocker was the Ubuntu Bazel clippy lane, which reached 21,652/21,653 and was canceled by the hosted 30-minute limit on each attempt. No source diagnostic was reported. The branch and commits remain preserved for a future retry when that hosted lane is healthy; required checks are not being bypassed. |
|
Reopened per campaign policy: the candidate remains worthwhile. The prior closure reflected repeated hosted Bazel clippy timeouts, not a source failure; required checks are not being bypassed, and the preserved branch will remain open for a valid retry. |
Stack
Summary
TurnCompleteEvent.provider_usagepersistenceSemantics
provider_usageis the element-wise aggregate of provider usage attached to successful response completionsfinal_modelandmodel_snapshotcontinue to identify only the terminal successful sampling responseValidation
cargo fmt --all -- --checkfromcodex-rsgit diff --checkjq empty docs/divergences/index.yamljust --show core-multi-agent-orchestration-targeted--no-tests=failand the core integration selector keepsRUST_MIN_STACK=8388608Validation-lab run #1864 targeted the earlier
44f2df994457f20c480845b973456a151a30bc7dhead. Protocol and failed-follow-up coverage passed; two core assertions expectedNonefor fixtures that explicitly report zero usage. Those expectations and the logical-turn reset seam are corrected in the current head. No final-head validation-lab run has been dispatched yet.Rust compilation and tests were not run locally; the exact regression selections are registered for GitHub-hosted validation.