Skip to content

Add an edit action for the latest user message#766

Closed
Amer-alsayed wants to merge 2 commits intopingdotgg:mainfrom
Amer-alsayed:codex/edit-last-user-message
Closed

Add an edit action for the latest user message#766
Amer-alsayed wants to merge 2 commits intopingdotgg:mainfrom
Amer-alsayed:codex/edit-last-user-message

Conversation

@Amer-alsayed
Copy link

@Amer-alsayed Amer-alsayed commented Mar 10, 2026

Fixes #762

What Changed

Adds an edit action to the latest eligible user message. Choosing edit restores that message into the composer, rehydrates image attachments when possible, and reverts the thread to the checkpoint immediately before that turn so the user can resend an updated prompt.

Why

This keeps the workflow close to Codex-style prompt editing without mutating historical messages in place. It reuses the existing checkpoint revert model instead of introducing a separate history-editing path.

UI Changes

Before:
Before

After:
After

Validation

  • bun run --filter=@t3tools/web typecheck
  • bun run --filter=@t3tools/web test

Scope

  • Single file change
  • No new backend command
  • Reuses existing checkpoint revert flow

Note

Add an edit action for the latest user message in the chat timeline

  • Adds an Edit last message button (pencil icon) on the last user message eligible for revert in MessagesTimeline, replacing the generic Undo button for that specific message.
  • On click, onEditLastUserMessage reverts the thread to just before agent work, then pre-populates the composer with the original message text and any restorable image attachments.
  • Image attachments are restored by fetching their previewUrl and reconstructing File objects via the new restoreComposerImageAttachment helper; attachments that fail to reload trigger a thread error notice.
  • onRevertToTurnCount is refactored to return Promise<boolean> so callers can gate composer restoration on revert success, and isRevertingCheckpoint is now reset in a finally block.

Macroscope summarized a98fca3.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Mar 10, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

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

Run ID: 2bc8d7d4-3034-4142-adae-a6e84fc1435b

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

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

Labels

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.

Allow editing the most recent user message by reverting the latest turn into the composer

1 participant