Skip to content

feat(chat): edit a previous user message and continue from there - #476

Open
Adam-Dalloul wants to merge 2 commits into
xintaofei:mainfrom
Adam-Dalloul:feat/edit-user-message
Open

feat(chat): edit a previous user message and continue from there#476
Adam-Dalloul wants to merge 2 commits into
xintaofei:mainfrom
Adam-Dalloul:feat/edit-user-message

Conversation

@Adam-Dalloul

Copy link
Copy Markdown

Hover a sent user message and click Edit. The composer restores that prompt (text, references, images). Send replaces it in the transcript and continues from there, the same gesture native CLIs have.

Why this shape

ACP still has no message/edit, and session/fork cannot yet fork from a midpoint (the RFD reserves messageId for that). Rewriting a CLI session file would be unofficial, so this PR does not touch agent stores.

What we can do for every agent on one path:

  1. Restore the chosen user turn into the composer.
  2. Hide that turn and everything after it from the transcript codeg displays.
  3. Persist those hidden timestamps so a reload stays truncated.
  4. Send the replacement as a normal session/prompt on the same session.

Claude, Codex, Grok, and custom ACP agents all already speak that prompt path. The discarded turns remain in the agent's own history (ACP cannot rewind them). The replacement is the latest user instruction, which is how a native "I meant this instead" already works.

This is conversation edit, not /rewind / file restore. That remains #185.

UI

  • Edit sits with Copy and Create task on persisted user bubbles.
  • Hidden in read-only views (sub-agent dialog, viewers).
  • Optimistic / in-flight bubbles are not editable.
  • If a turn is running, Edit + Send cancels it and queues the replacement so it does not race session/cancel.
  • Escape or the X cancels the edit.

Tests

  • src/lib/edit-user-message.test.ts (hide set, restore, editability)
  • conversation_edit_service unit tests (filter + JSON parse)
  • Existing composer / message-list tests still pass
  • tsc --noEmit clean

@Adam-Dalloul
Adam-Dalloul force-pushed the feat/edit-user-message branch from 4f5de3b to eb3fc32 Compare August 16, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant