cmux-next: a reopened Codex or Claude chat shows each turn's tool calls
Summary
Reopening a Codex chat in the cmux NEXT agent pane showed each past turn as its final message and a "Worked for 1m 32s" footer that opened nothing, even when the turn ran commands and edited files (manaflow-ai/cmuxterm-hq#2569, item 3). Codex desktop shows that work under a collapsible "Worked for".
The calls were lost in acpmux's adoption replay. adopt_replay::read turned the harness transcript into prompt and answer pairs only, so Hub::replay_adopted never appended a tool_call. The webview was fine: with no tool rows, a settled turn has nothing to fold.
Now the replay reads each turn's tool calls too (adopt_tools.rs) and appends a tool_call plus its settling tool_call_update before the answer, the same records a live turn leaves:
- Codex: reads
item_completedcommands, file changes, MCP calls and web searches from current rollouts, andexec_command_endand patch events from older ones. A file change keeps each hunk as adiffand lists every file with its +/- counts inrawInput.changes. That's the data the edited-files card (item 4) needs. - Claude Code: each
tool_useand itstool_resultgo through the live path's own builder.claude_stdio::tool_call_fieldsis now shared byinbound.rsand the replay.
In the pane, "Worked for" now opens through the existing settled-run line ("Edited files, ran commands") to "Ran 3 commands" and "Edited 2 files +4 -1", and each command opens to its line. No new chrome. The one webview change: the run summary counts edited files rather than edit calls, so one Codex change over two files reads "edited files".
Testing
Failing tests first (6931c710820), fix after:
cargo test -p acpmux --test hub_integration adopt_replays(Huge Blue): on the base, both new tests fail. Codex replaysturn_started, user_message, agent_message_chunk, turn_end, turn_resultand no tool calls. At 2c2b9a6e90e all 9adopttests pass.adopt_replays_a_codex_turns_commands_and_file_editsadopts a Codex Desktop-shaped rollout fixture (tests/fixtures/codex-rollout-tool-calls.jsonl).adopt_replays_a_claude_turns_tool_callsadopts a Claude Code transcript through the fake Claude harness, including a failed call.- The Codex test also writes and checks
webviews/test/fixtures/adopted-codex-turn.events.json, the daemon's own replayed records (ACPMUX_UPDATE_FIXTURES=1rewrites it).agent-pane-adopted-tool-calls.test.tsloads those records into the pane. CMUX_BROWSER_TESTS=1 bun test test/agent-pane-adopted-tool-calls.test.ts(big-red, Chromium): on the red commit there is no "Worked for" disclosure. At 190f2a4ac8a it passes, together withagent-pane-turn-footerandagent-pane-step-rows(6 pass).- Also on Huge Blue:
cargo test -p acpmux --lib claude_stdio(24 pass),--test chats_transcript --test chats_open(pass),cargo clippy -p acpmux --all-targetswith no warnings, andcargo fmt. On big-red:tsc --noEmit,vp lint/vp fmton the changed TS, andcheck:browser-lanes.
Observed / Not run
Observed: the red and green results above, at the named commits.
Not run: a cmux NEXT app build or live dogfood of adopting a real Codex chat (no Swift builds here). The full acpmux suite was not run; CI covers it.
Risk evidence (high tier)
Review: SHIP at 924fc9fe6a9cc98f29f2059de3a2af917f0d5a4e (cmux-review subagent; correctness first)
Runtime test: cargo test -p acpmux --test hub_integration adopt on Huge Blue at 924fc9fe6a9cc98f29f2059de3a2af917f0d5a4e (11 pass; cargo clippy -p acpmux --all-targets clean)
Changelog
Fixed: Reopening a Codex or Claude Code chat in cmux NEXT shows each turn's commands and file edits under "Worked for", not only the final message.
Proof
The browser test drives the pane over the daemon's replayed records: "Worked for 1m 32s" expands to "Edited files, ran commands", then to "Ran 3 commands" and "Edited 2 files +4 -1", and each command line shows. No screenshot.
Checklist
- Behavior changes have added or updated tests
- Localization: no new or changed strings
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Reopening a Codex or Claude chat in the cmux NEXT agent pane now shows each turn's tool calls under the "Worked for" fold, where before the adoption replay kept only prompt and answer pairs.
Bug Fixes
adopt_replayreads tool calls from the harness transcript, andHub::replay_adoptedreplays them astool_callandtool_call_updaterecords before the answer, matching a live turn.- Codex turns read
item_completedevents (and olderexec_command_end/patch events); Claude Code turns readtool_use/tool_resultvia the sharedclaude_stdio::tool_call_fields. - Each file change keeps its hunks as diffs with +/- counts for the edited-files card; a failed patch shows its error without the edits, and a hunk marked as a fragment disables whole-file Undo.
- The run summary counts edited files, not edit calls, so a diff-less edit counts the files its input names.
- A malformed Codex duration saturates instead of overflowing, and the adopted-rollout tests no longer need a backdated transcript.