Repository navigation
fix(#9228): sum Claude turns across result events - #9814
AshwinUgale wants to merge 1 commit into
Conversation
Signed-off-by: Ashwin Govind Ugale <ugaleashwin@gmail.com>
PR Summary by QodoSum Claude turns across result events
AI Description
Merge Risk
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 7:51 PM UTC · Completed 7:57 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.90 |
|
Risk Assessment: moderate (2/5) DetailsSmall, focused telemetry bug fix with test coverage matching issue scope, though moderate risk is driven by high regression history and change coupling in touched runtime files. |
|
Looks good to me Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me |
Summary
Claude Code writes another
resultevent each time a background task resumes a finished session.num_turnscovers only that segment, but fullsend kept the last one, sometrics.jsonandfullsend.num_turnsundercounted.Related Issue
Part of #9228. The single "→ Result" log block is left for a follow-up.
Changes
parseClaudeStreamtotalsnum_turns, so eachResultEventcarries the turns so far.recordClaudeMetricsstays last-wins, which also works with fix(#6806): capture num_turns from incomplete Claude streams #7687.modelUsageare already running totals and are unchanged.Testing
make lintpasses (stage changes first, then run): not run locally;go vetand gofmt are cleanTests added/updated for new or modified logic
Replayed 355 Claude streams from the agents nightlies (Claude Code 2.1.306): 11 change, all review runs, from 2–11 turns to 23–30. Every other metric is identical.
New test with one of those runs' turn counts; the existing two-result test now checks turns. Both fail without the fix.
53
internal/runtimetests fail under WSL here, all of which fail without the fix too.Not covered
modelUsagefall back tousage, which is also per segment. All 11 runs hadmodelUsage.Checklist
!for breaking changes)