cmux-next agent pane: count a turn's tool calls in its summary

Merged
TE
1mo ago
+192-117

Part of the cmux-next parity work listed in #16174 (comment). One of the four agent pane bugs from the real-agent clip in #16231 (comment).

Problem

The turn summary under a reply said "1 tool calls" when the turn ran 7. The summary took its count from the last activity row only, and the label never used the singular.

Change

  • The direct client sums the tool calls of every activity row since the turn's user message, and times the turn from that message.
  • The fold ("Worked with N tool calls") and the summary use the singular for one call.

Verification

  • Red first: commit 1 adds tests in direct.test.ts (counts and duration across two turns) and transcript.test.tsx (singular label), which fail before the fix.
  • bun test src/agent-session/acpmux (90 pass), typecheck, lint:ci, build-agent-pane-web.sh --check.

Screenshots

A real-agent clip from one fleet build with all four transcript fixes (feat-cmux-next-transcript-fixes-demo) will be added here. The mock transport writes rows directly and skips the client reducer, so a mock capture cannot show this fix.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes the cmux-next agent pane turn summary so it counts the tool calls and time of the current turn instead of the whole session. The summary previously showed the session's activity total ("1 tool calls" after a 7-call turn) and no duration; it now sums calls and times the turn from its user message, and one call reads "1 tool call".

  • Prompts queued while a turn runs no longer restart the count.
  • A summary without a loaded start time shows only its count.