Skip to content

fix(web): restore reverted messages to composer - #6044

Closed
amitray007 wants to merge 7 commits into
pingdotgg:mainfrom
amitray007:fix/revert-message-to-composer
Closed

amitray007 wants to merge 7 commits into
pingdotgg:mainfrom
amitray007:fix/revert-message-to-composer

Conversation

@amitray007

@amitray007 amitray007 commented Aug 10, 2026 •

Copy link
Copy Markdown

What Changed

Reverted user messages now return to the composer with their images. If a draft is already present, it is saved to Stash first.

The live timeline also removes the reverted message once the server confirms the rewind.

Why

“Revert to this message” rewound the checkpoint, but left the selected message in the timeline and forced users to recreate the prompt before sending it again.

Closes #5685

UI Changes

Before After
Before revert After revert

Interaction

bettershot_1786392103024.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Built with GPT-5.6-Sol through T3 Code.

Note

Restore reverted user message prompt and attachments into the composer

  • When reverting a thread checkpoint, the user's original message prompt and image attachments are now fetched and written back into the composer after revert completes.
  • deriveRevertedMessageContent strips review comment blocks and preview-annotation screenshots from the prompt before restoration; fetchRevertedMessageAttachmentBlob fetches attachment blobs with a 10-second abort timeout.
  • The composer is disabled during revert preparation; attachments are deduplicated, capped at PROVIDER_SEND_TURN_MAX_ATTACHMENTS, and any existing stash or context attachments are cleared before writing.
  • Toasts surface warnings for missing images, attachment overflow, stash/clear behavior, and stash failures.
  • Turnless message retention in threadReducer is now bounded by the latest retained checkpoint instead of keeping all turnless messages unconditionally.
  • Risk: blob URLs are created during draft preparation and must be revoked on cleanup; any fetch failure within the timeout marks that attachment as unavailable rather than blocking restoration.

Macroscope summarized a216c72.


Note

Medium Risk
Touches checkpoint revert UX and client-side message retention after thread.reverted, plus blob URL lifecycle for restored attachments. Failures are mostly soft (toasts / unavailable images), but incorrect retention or cleanup would affect timeline correctness and composer state.

Overview
Reverting a checkpoint now puts the selected user message back into the composer (editable text + images), so users can edit and resend instead of recreating the prompt.

Existing draft text/images are stashed first when possible; session-bound context (terminal/element/preview/review) is cleared because it cannot be safely reused after a rewind. Preview-annotation screenshots and review/context blocks are stripped from the restored prompt. Attachment blobs are fetched with a 10s abort timeout, deduped, and capped at the composer image limit, with toasts for missing/overflow images and stash/clear outcomes.

Separately, retainMessagesAfterRevert now drops turnless messages after the latest retained checkpoint, so the timeline actually removes the reverted prompt once the server confirms the rewind.

Reviewed by Cursor Bugbot for commit a216c72. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad10ca3c-9852-4304-9a76-f7b9f24cfd86

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 10, 2026
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread packages/client-runtime/src/state/threadReducer.ts
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from 1ea7561 to 7595b96 Compare August 10, 2026 20:13
@amitray007
amitray007 marked this pull request as ready for review August 10, 2026 20:23
@macroscopeapp

macroscopeapp Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new feature for restoring reverted messages to the composer, including attachment fetching, draft stashing, and complex state management. Despite the 'fix' prefix, the ~670 lines of additions represent significant new user-facing capability that warrants human review.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx Outdated
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from e78c60f to 50b09fb Compare August 11, 2026 15:53
Comment thread packages/client-runtime/src/state/threadReducer.ts
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/ChatView.tsx Outdated
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from 176cb9f to 813cdec Compare August 11, 2026 16:20
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from 813cdec to 578d132 Compare August 11, 2026 16:32
Comment thread apps/web/src/components/ChatView.tsx
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from 578d132 to ad77987 Compare August 11, 2026 16:45
Comment thread apps/web/src/components/ChatView.tsx
@amitray007
amitray007 force-pushed the fix/revert-message-to-composer branch from 4e9ba03 to af4d491 Compare August 11, 2026 19:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af4d49122a15121bd56b5a385e0d64db176d5ecd. Configure here.

Comment thread apps/web/src/components/ChatView.tsx
@amitray007

Copy link
Copy Markdown
Author

Won't be able to maintain this PR anymore. Feel free to use the code if needed, using a personal fork going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Revert leaves selected user prompt visible and composer empty

1 participant