Skip to content

feat(web): restore user prompt to composer input on revert#2

Open
MaximIJ wants to merge 2 commits intomainfrom
revert-prompt-restore-clean
Open

feat(web): restore user prompt to composer input on revert#2
MaximIJ wants to merge 2 commits intomainfrom
revert-prompt-restore-clean

Conversation

@MaximIJ
Copy link
Owner

@MaximIJ MaximIJ commented Mar 21, 2026

What Changed

When reverting a checkpoint, the user's original prompt text is now restored into the composer input field so they can edit and re-send without retyping.

Specifically:

  • onRevertUserMessage now looks up the reverted user message and extracts the visible prompt text using deriveDisplayedUserMessageState (strips terminal context blocks)
  • onRevertToTurnCount accepts an optional promptToRestore param and writes it back into the composer after the revert completes
  • A 300ms setTimeout defers the restore past the server state sync (throttled at ~100ms) to prevent re-renders from overwriting it
  • The composer is focused with cursor at end of text after restore

Why

When a user reverts a message, they typically want to tweak the prompt and re-send. Currently they have to retype the entire prompt from memory. Restoring it into the composer removes that friction.

This is a small, focused UX improvement — one file changed, no new dependencies, no scope expansion.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI layout changes (behavior-only change, no screenshots needed)

Maxim IJzelendoorn and others added 2 commits March 21, 2026 20:19
When reverting a checkpoint, the original user prompt text is now
restored into the composer input field so the user can edit and re-send
without retyping. Uses deriveDisplayedUserMessageState to extract just
the visible prompt text (stripping terminal context blocks).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skip restoring the user prompt into the composer when the checkpoint
revert fails, so users don't see their prompt return alongside an
error message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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