Repository navigation
fix(clients): count every call behind a folded tool burst in the step summary - #834
Merged
Merged
Conversation
… summary
A folded run of steps showed a wrench count that disagreed with the list the
user gets by tapping it. A run folds projected step rows, and one of those rows
can itself be a same-kind burst the projection already collapsed ("运行 2 次"
with two children) — counting rows scored that burst as a single call, so a run
of 2 + 1 + 1 calls read ×3. Both clients did this deliberately (the desktop
matched mobile on purpose), which left the badge contradicting the rows right
underneath it.
Count the work instead: a tool step contributes its `count` — the same number
its own label prints when opened — defaulting to 1 (reasoning steps still count
1). Desktop's ReplySteps and mobile's stepRunCounts now agree with their
expanded lists. The failure count is unaffected: a collapsed burst is completed
calls only.
Falsified before fixing: the new mobile test failed as ×3 · ×2, and reverting
the desktop sum made its burst test fail as ×1 · ×1.
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.
The bug
The folded run's summary badge (
🔧×3 · 🧠×2) contradicted the rows the same line reveals when tapped. Reported from a real reply:2 + 1 + 1 = 4 tool calls underneath, badge said 3.
Why
A run folds projected step rows, and one of those rows can itself be a same-kind burst the shared projection already collapsed (
count: 2+ two children, rendered as "运行 2 次"). Both clients counted rows, so that burst scored as one call. The desktop did this on purpose (ReplySteps.tsxsaid "Mobile counts projected step rows…"), so the two clients agreed — but both disagreed with the list they reveal.The fix
Count the work, not the rows: a tool step contributes its
count— the same number its own label prints when opened — defaulting to 1. Reasoning steps still count 1.mobile/src/components/TimelineCard.tsx—stepRunCountsdesktop/src/features/agent/ReplySteps.tsx— the tools sumThe failure count is untouched: a collapsed burst holds completed calls only.
Tests
burst(2) + thought + write + run + thought→×4 · ×2), asserting the expanded rows add up to the summary.×1·×1→×2·×1).Falsified before fixing: the new mobile test failed as
×3 · ×2, and reverting the desktop sum made its burst test fail as×1 · ×1.Checked:
mobilejest (TimelineCard,ChatScreen,ComposerDock),tsc --noEmit,eslint;desktopvitest (ReplySteps,MessageBlock.compaction),tsc --noEmit,eslint.