Agent chat: one live block at the bottom of a running turn; Writing a command while Claude writes it

Merged
TE
15d ago
+335-72

On nightly 3a63d6d (which includes #23081), Leo saw a running turn split in two: a "Working for 18s" header at the top, then tool rows, then a separate "Thinking" far below. And for a command that had not started yet, the live line read "Running a command 9s".

Why

  • The split turn: in the Codex layout (codexLiveTurn, the default since #23081), the "Working for" line sits right under the turn's first prompt, and the live line is the turn's last row. Leo's Claude sessions are mostly steers (19 of 24 prompts in his live session). His steers land between the two lines, so they end up far apart. No flag was off, and nothing had been reverted. The gallery missed it because its Codex entries have no steers.
  • "Running a command": Claude sends a Bash call with no input first, and its command up to 20s later, while the model writes it (from his session's events). The line showed the shell fallback, "Running a command", for a call that was still pending with no command.

What changed

  • One live block: the Codex layout no longer draws a line over the turn. The one live line at the bottom of the turn reads:
    • "Thinking 18s" between steps, timed from the prompt, with "· 2.1M tokens" when the harness reports them;
    • otherwise, the call in flight with its own time.
  • "Writing a command 9s": the line shows this while the command is still being written (a pending shell call with no command yet). It offers no ⌃B until the command runs. The new tools.writingCommand string has all 21 locales of the agent pane catalog.
  • Counts on the live line: with the running tray off (Debug subagentTray), the live line draws the agents, commands and sessions counts that the header used to draw. Each count opens what it counts, and they show beside a call too. With the tray on (the default), the tray is the count, as before.
  • Token count: "· 679.9K tokens" is secondary: the tool rows' quieter color, in tabular numerals.

The other fix Leo asked for, splitting a finished steered turn's "Worked for" fold at each steer, is a separate PR (#23771).

Changelog

  • Changed: a running agent chat turn shows one live line at its bottom, with no "Working for" line over its work. A command Claude is still writing reads "Writing a command", and the turn's token count is secondary.

Tests

test/transcript-codex-live-line.test.tsx:

  • no WORKING row in a running Codex-layout turn;
  • a steered turn is one live block at its bottom, timed from the prompt ("Thinking 18s");
  • the line carries the turn's tokens while it times the turn, but not next to a call;
  • a pending Bash call with no command reads "Writing a command 9s" and has no doingCommand; once its command arrives, it reads "Running cargo test" and offers ⌃B.
  • with the tray off, the line counts background work, beside a call too, but not on the start status line.

The e2e tests that looked for the old "Working for" line now read the bottom live line:

  • agent-pane-working-counts.test.ts;
  • agent-pane-peer-chat.test.ts: the clock-skew check reads "Thinking Ns" before the first call;
  • agent-pane-activity-line.test.ts.

Gallery: transcript#working-tokens now expects the line to read "Thinking … · 2.1M tokens" at the bottom. The notes for codex-turn-live are updated.

Observed / Not run

  • Observed: the events of Leo's live Claude session on this Mac (read-only):
    • a Bash call is pending with title "Bash" and no input for 20s, then in_progress with its command;
    • 19 of 24 prompts are steers.
  • Observed: the live Codex turn at 2a3491e2 on cmux-mac-mini-cua, before this change: "Working for 25s" at the top and the live line at the bottom.
  • Not run locally: the type checker, unit tests and the gallery. They run in this PR's CI (this Mac does not build).
    No capture: webview-only change; the gallery advisory run captures the changed entries.

Agent session: cosmic-gray

🤖 Generated with Claude Code