cx-ncc.61: ‹ n/m › arrows between an edited prompt's versions

Merged
TE
1mo ago
+885-12

Claude parity (cx-ncc.61): after Edit and resend (#19470), the prompt shows ‹ n/m › to switch between its versions and the replies that followed, as in Claude. Edit and resend forks the chat before the prompt and sends the edited text in the fork, so each version is a sibling chat:

  • In the chat that was forked, the prompt the edit replaced shows 1/2.
  • In the fork, the edited prompt shows 2/2.
  • Previous and Next open the sibling chat in the same pane (chat.select).

acpmux (one line, hub/views.rs): the session summary now includes forkSeq next to parentId. Both were already stored on every fork.

Pane:

  • sessionEntry keeps parentId, forkSeq and turnCount.
  • The reducer records the fork's forked boundary event, which acpmux appends after the history it copies. This is where the fork's own first prompt starts.
  • conversation/branches.ts groups the versions.

A version is the chat that was forked, or one of its forks at the same turn, that went past that turn (turnCount above the inherited turns). Side chats, archived forks and forks nobody sent in are not versions. Versions are ordered oldest first; session ids are UUIDv7s.

Limits:

  • Versions show only when the boundary rows are loaded. In a fork with more than about 400 events before the edit, attach loads the newest page first, so the fork's arrows appear once older history is loaded.
  • Editing an edited prompt again forks the fork, which gives a nested group under that fork.

Native port: cmux-next has no native agent transcript (it is all in the web pane), so nothing to port.

Testing

  • Red: test/agent-pane-branches.test.ts failed on the base code at f5bbe2f2adc3 (the real pane in Chromium against a stand-in acpmux; it timed out waiting for 1/2). It passes on the fix and on the merged head, run locally with CMUX_BROWSER_TESTS=1.
  • acpmux: a_fork_through_the_latest_turn… now asserts the summary's forkSeq. It is running on hosted Linux and macOS (verify-cmux-tui-hosted.sh). The red side of this Rust assertion was not run separately.
  • bun run check, tsc, and the edit-resend, gallery-coverage and stylesheets tests pass. The ui-rules test fails only on base's changes/GitActions.tsx (base red).

Changelog

Added: An edited message in the agent pane shows ‹ n/m › arrows to switch between its versions.

🤖 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

Shows ‹ n/m › arrows under an edited prompt in the agent pane to switch between its versions, matching Claude. Edit and resend forks the chat before the prompt, so each version lives in a sibling chat; Previous and Next open that sibling in the same pane.

  • acpmux's session summary now includes forkSeq alongside parentId, both already stored on forks.
  • The pane records the fork's forked boundary event and groups versions in conversation/branches.ts: a version is a chat that went past the fork turn, excluding side chats, archived forks, and forks nobody sent in.
  • Versions show only once the chat's whole history is loaded; in a fork with many events before the edit, arrows appear once older history loads. Editing an edited prompt again forks the chat it came from at the same turn, so every version stays a sibling.