feat(web): show Claude round usage metadata - #1655
Merged
Merged
Conversation
There was a problem hiding this comment.
Findings
- No findings.
Summary
Review mode: initial
No issues meeting the ≥80% confidence threshold were found in the added or modified lines. Residual risk: the change spans CLI message ordering and Web normalization/reconciliation, so correctness still depends on the full automated suite and representative Claude SDK result shapes.
Testing
- Not run (automation); static review only. The diff adds coverage for result conversion, queue ordering, malformed-counter normalization, sidechain attachment, late reconciliation, tool-only grouping, and metadata formatting.
HAPI Bot
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
This follows up on #637, which aggregated per-message metadata across a response group. Claude's final SDK result now lets the same surface show authoritative round-level usage, cost, duration, and turn count instead of deriving them from individual messages.
Details
Claude assistant messages expose per-message usage, while the SDK's final result contains the complete round-level usage, per-model breakdown, cost, duration, and turn count. The CLI now forwards that result through the existing
system/turn_durationcarrier without advancing the main or sidechain parent chain. The remote queue preserves visible system carriers and drains them beforeready, while Web reconciliation retains late-arriving round summaries. The web app validates it at the normalization boundary, attaches it to the preceding contiguous assistant response group, and prefers it over derived per-message aggregates.Malformed counters fail closed. Token and turn counts require non-negative safe integers, cost and duration require finite non-negative numbers, and a zero cost is omitted rather than presented as free usage.
Test plan
Screenshots