agent-chat: Codex-style turn footer with Undo and Retry

Merged
TE
1mo ago
+817-264

Part of the cmux-next parity work listed in #16174 (comment).

Stacked on #17086 (base feat-cmux-next-tool-groups); I will retarget to feat-cmux-next once that lands.

Problem

The card under a turn that edited files offered only View changes, with hardcoded English strings. The Codex app's footer reads "Edited summarize_run.py +56 -0" with Undo and View changes on the right. Our footer also had no way to retry the last prompt.

Change

  • Edited-files card (conversation/EditedFilesCard.tsx, moved out of App.tsx):
    • Undo now sits next to View changes, and every string is localized (en and ja).
    • Undo asks the agent to revert every hunk of the turn through the same requestRevert path that hunk rejection in the changes view uses. Both surfaces therefore mark the hunks as requested.
    • After Undo, the card reads "Undo requested" and is disabled. A hunk already sent from the changes view is left out of a later Undo.
  • Turn footer: the last turn gets Retry, which sends its prompt again through chat.send. Retry is offered only while acpmux is reachable and disappears once a later prompt goes. The Copy and Fork labels and the failure note are localized.
  • Deferred fix from #17086: a coordinator send whose text comes from a file (tell-coordinator - < note.md, cat note.md | tell-coordinator -) stays a command row instead of becoming a card reading "No message text".

Item 3's localhost web preview card follows in a separate PR. It needs Swift changes (CSP frame-src for loopback, subframe navigation, and routing opens to openBrowser instead of NSWorkspace), so it gets its own review.

Verification

  • bun test src/agent-session/acpmux: 658 pass.
  • New DOM tests (turnFooter.test.tsx):
    • the card reads "Edited summarize_run.py+2-1" with Undo and View changes;
    • Undo sends one revert prompt and then reads "Undo requested";
    • a requested hunk is left out of a later Undo;
    • there is no Undo without the hunk review;
    • Retry sends the prompt, and is absent on earlier turns or when offline.
  • Other new tests: turns.test.ts (only the last footer carries the prompt, and its version changes when a later prompt arrives), diff.test.ts (undo prompt fencing), agentMessages.test.ts (file-sourced sends; red commit 28f4540eca9, then the fix).
  • vp check --no-fmt is clean. Formatting fails only on base's mockFiles.ts.
  • The bundle was regenerated with bun 1.4.2, and build-agent-pane-web.sh --check reports it current.
  • Localization audit: the 14 new keys exist in both en and ja.
  • Captures against the Codex reference will follow from a fleet build.

— cc-pane-transcript

šŸ¤– 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

Adds Codex-style turn footer actions: Undo on the edited-files card and Retry on the last turn.

Undo asks the agent to revert every hunk of the turn through the same hunk-review path as the changes view, so both surfaces mark the hunks as requested; a failed revert send restores the reader's prior decisions. The card covers the whole ended turn (including edits after the answer), reads "Undo requested" once asked, and leaves out hunks already requested elsewhere. Retry resends the last turn's prompt while acpmux is reachable, and disappears once a later prompt goes (or waits to be accepted).

All card and footer strings are now localized (en and ja). Deferred fix: coordinator sends whose text comes from a file (tell-coordinator - < note.md) stay command rows instead of rendering as a card with no text.