Agent chat: consecutive tool calls consolidate into fewer, counted rows
Leo-ask: ask-91d2e57f8f
Leo (2026-10-21): "also i think this wrt the whole thinking situation and all that we can pretty obvioulsy make it better... like it can consolidate a ton of these tool calls and such tbh in the ui it seems p straightforward the things i said earlier".
What main already had
#23081 (not in Leo's nightly 03960f5) already folds a finished run into one summary line ("Read files, ran commands") and merges runs around a short note (mergeShortNotes). What still spread out:
- the summary line said what kinds of call ran but not how many, and a failed call vanished behind it;
- a thought between two calls of one kind split the group ("Ran a command", thought, "Ran a command");
- one coordination card (a message to another agent, a sub-session) or one edit in a run turned folding off for the whole run, so every group and lone call took its own line.
What changed
- Counted lines, as Claude desktop draws them: "Read 6 files, ran 4 commands". Reads count distinct files, edits the files they changed, searches count on their own ("ran 2 searches") instead of hiding inside "read files". A failed call adds "1 failed" in the error color on the line (the same marker the group lines use).
- Thoughts don't split groups: a thought between two commands, reads or searches stays inside their group, in its place (drawn as its Thought row when the group is open). "+K more" counts calls, not thoughts.
- Cards and edits stay in sight, everything around them folds: a folded run is split at coordination cards and edits (
runStretches); each stretch of other work folds into its own counted line. An opened Worked for now folds a run that edited too (its edits stay visible between the lines). - The final reply is untouched (it is never part of a run). This does not touch
answerAt(#23843's area).
Strings: toolRun.{read,ran,edited,used}.other gain {n} in all 21 languages; toolRun.searched becomes toolRun.searched.one / .other.
Screenshots
Before/after (gallery, agent-pane.transcript, new states consolidated-run and consolidated-live-run, plus the existing folded-run states): https://cmux-lawrences-mac-mini.tail137216.ts.net:18796/compare/tp-consolidate-tool-rows/?entry=agent-pane.transcript
Changelog
- Changed: agent chat folds consecutive tool calls into fewer, counted lines ("Read 6 files, ran 4 commands"); thoughts between calls no longer split them, and a message card or edit in a run no longer stops the rest from folding.
Tests
webviews/test/transcript-consolidated-runs.test.tsx: reads, searches and commands with thoughts between them draw one counted line; a thought between same-kind calls stays in the group; an edit and a coordination card stay in sight while the work on each side folds; a failed call is counted on the line; an ended turn's opened Worked for folds a run that edited. Updated the summary strings in transcript-live-runs, agent-pane-bottom-stack and agent-pane-step-rows.
Observed / Not run
- Thought state (Codex xhigh review, 3 rounds): a thought keeps one id,
<row>:thought:<n>(n = thoughts before it in the run), as its key and saved-choice id whether it draws alone or inside a group.webviews/test/transcript-group-thought-state.test.tsx(4 tests): tail moves and "+K more"; a finishing read joins an opened thought to a group; one activity shown twice; a later thought takes a standalone thought's place. On huge-blue at 27604b9: 4/4 pass, and transcript-consolidated-runs 8, TurnRows.test 5, agent-pane-unknown-write-tool-group 3, transcript-live-runs 7 and codex-tool-runs 1 also pass, with tsc clean for the changed files. With ToolGroupRow.tsx and TurnRows.tsx put back to 294e48f, 3 of the 4 fail; with only TurnRows.tsx at 465e486, the last one fails. - Fast gates at 50a8619 failed on this PR's own fixture (a fleet host name in transcript.gallery.ts); fixed in 294e48f.
- Observed on cmux16 at 50a8619fc17e (base 31afd27897eb merged in for a turns.ts import conflict):
bun testper file passes for every non-browser test undersrc/agent-session/acpmux/conversation/and everytest/transcript-*and tool-row test (60+ files, among them transcript-consolidated-runs 8, transcript-live-runs 7, transcript-codex-live-line 23, transcript-worked-fold 9, transcript-density 4, agent-pane-mcp-tool-rows 12, TurnRows.test 5, ThoughtRow 24).bun run check(Oxlint, Oxfmt, type check, layer and catalog checks) passes. - Red before the fix: the new test file at the old base d03a635fc5db fails (the base has no
runStretchesand counts nothing). test/tooltip-rules.test.tsfails the same 9 entries at base 31afd27897eb and at this head (base red).- Not run: agent-pane-step-rows and agent-pane-bottom-stack (Playwright; skipped without Chromium); their only change is the summary string they look for. No Swift changed.
- CI reds at the first head were base reds:
cmux-next checks(Package conventions lint onAttentionHighlightLook.swift, job-structure test), the nightly/CI guard groups (same failures as #23843), gallery health'schanges-scope-menu#keyboardandcomposer#steer-read-hover. - Size: 866 changed lines, 354 of them the string catalog (four strings gain
{n}in 21 languages, two new keys).
Agent session: cosmic-gray
🤖 Generated with Claude Code