cmux-next: edited files in the chat menu's Changes and the summary's Outputs (hq#2569 item 4)
Summary
Stacked on #22155: it contains #22155's commits, so land that first. Only the last two of this PR's own commits are new (27c092b1ad3 tests, cfe96e7f8e6 fix).
In the cmux NEXT agent pane, a Codex turn that edited files didn't match Codex desktop (manaflow-ai/cmuxterm-hq#2569, item 4). There was no "Edited N files" card on a reopened turn, the chat actions menu had no Changes entry, and the Summary panel said "Outputs: None".
- Edited-files card: the card and its Settings > Agents > Edited Files Card setting already existed. It never drew on a reopened turn because adoption replayed no edit records. #22155 replays them (each file's path, +/- counts and hunks), and with that the card draws "Edited 2 files +4 -1" with one row per file. Its View changes opens the existing changes view with the hunks. No change here beyond the test.
- Changes in the chat menu: "..." now lists Changes while the chat has changes, even when its header button shows, as the Codex and Claude apps' chat menus do. Before, it was listed only when the button was hidden.
- Summary Outputs: Outputs lists every file the chat changed. Before, it dropped the last turn's files and listed them only under Changes, so a chat whose one editing turn was the last said "Outputs: None". Changes is now the single row that opens the last turn's diff with its totals. Each Outputs file still opens the changes view at that file.
- Undo: the card's existing Undo (the host's
turn.undorevert, with a confirmation) is unchanged. A reopened Codex turn's edits carry hunks, not full file texts, so Undo isn't offered for them. No new revert path.
Testing
Failing tests first (27c092b1ad3), fix in cfe96e7f8e6. All on big-red, with CMUX_BROWSER_TESTS=1 bun test in webviews/ and real Chromium:
test/agent-pane-adopted-edited-files.test.ts(new). It loads acpmux's own replay of a Codex rollout (the fixture #22155's Rust adoption test writes) into the pane's dev entry over a stand-in daemon. It checks the card's title and per-file rows, that View changes draws the hunks, that the chat menu lists Changes, and that Outputs lists both files with counts.test/chat-header-fold.test.tsxandtest/sources-files-once.test.tsx, updated for the new menu and Outputs behavior.- Red, at 27c092b1ad3: 5 of 7 fail ("the chat menu lists Changes", "the summary's Outputs lists the edited files", both
sources-files-oncetests, and the firstchat-header-foldtest). The card test already passes there because #22155 supplies the records. - Green, at a83a2984ee1: all 9 pass, including
agent-pane-adopted-tool-calls.test.tsfrom #22155 and the summary tests. bun run typecheckpasses.bun run lintreports 0 errors and 3 warnings, all insrc/motion/files this PR doesn't touch.scripts/verify-local.py --affected origin/feat-cmux-next: 9 of 10 checks pass.localizationfails onneeds_reviewstates in Swift catalogs (for exampleAccountsActions.xcstrings). Neither this PR nor #22155 touches those catalogs.
Observed / Not run
Observed: the red and green browser and jsdom results above, the typecheck, and the lint and verify-local output.
Not run: a cmux NEXT app build or live dogfood. In the browser host, View changes opens the diff in place; in the app it opens beside the chat, and that path was only read, not run.
Risk evidence (high tier)
Review: SHIP at 1d3da297d729fd4d6b064c0b1f78d545c1825662 (cmux-review subagent; correctness first)
Runtime test: cargo test -p acpmux --lib adopt (8 pass) and cargo test -p acpmux --test hub_integration adopt (11 pass) on Huge Blue at 1d3da297d729fd4d6b064c0b1f78d545c1825662; CMUX_BROWSER_TESTS=1 bun test test/sources-files-once.test.tsx (6 pass) on big-red at 1d3da297d729fd4d6b064c0b1f78d545c1825662
Changelog
Fixed: In cmux NEXT, a reopened chat's edited files show in the chat menu's Changes entry and under the summary's Outputs, and the edited-files card draws for reopened Codex turns.
Proof
The browser test drives the pane over the replayed records. No screenshot.
Checklist
- Behavior changes have added or updated tests
- Localization: no new or changed strings (Changes reuses
header.changes)
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
A chat adopted into the cmux NEXT agent pane now replays each past turn's tool calls and file edits, so a reopened Codex or Claude turn shows the commands it ran and the files it changed as they appeared live. New work since the last summary is limited to merges of feat-cmux-next; no behavior changes.
Bug Fixes
- A reopened Codex or Claude turn replays its tool calls as
tool_callandtool_call_updaterecords, so its "Worked for" line opens to its commands and edits. - A failed or declined Codex edit shows its files but no diffs or counts; an unconfirmed Claude edit's proposed diffs wait for its result before any card or Outputs row counts them.
- The chat menu now lists Changes while the chat has changes, beside its header button, as the Codex and Claude apps' chat menus do.
- Outputs lists every file the chat changed, including files only the last turn's checkpoint knows (a shell command or formatter edited them); it previously dropped the last turn's files and said "Outputs: None".
- A file the last turn changed again opens that turn's diff with its totals, listed once.
- An Outputs row matches a last-turn file by its exact path first, so a same-named file in another folder keeps its own row and opens its own diff.
- Replayed Codex hunks are marked as file fragments, so the edited-files card offers no Undo for them; the existing Undo path is unchanged.