Skip to content

feat(chat): edit the final user message - #7237

Closed
ipanasenko wants to merge 9 commits into
pingdotgg:mainfrom
ipanasenko:t3code/be0955f1
Closed

ipanasenko wants to merge 9 commits into
pingdotgg:mainfrom
ipanasenko:t3code/be0955f1

Conversation

@ipanasenko

@ipanasenko ipanasenko commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Users could not correct a thread-ending prompt after the thread became idle without sending a separate follow-up.

This adds a first-class message-correction command and event across contracts, server orchestration, projections, persistence, relay snapshots, and both web and mobile clients. Edit is offered only when the final visible message is the user message and the thread is idle. Corrections preserve structured context, reject stale edits, start a normal replacement turn, remain consistent through pagination and server restarts, and reconcile correctly when checkpoints are reverted.

edit-last-message-before edit-last-message-after

Implemented with gpt-5.6-sol via Codex in T3 Code.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

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: 092a35f9-e7b6-48e9-b56b-a27fb390172a

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 Author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Aug 16, 2026

@macroscopeapp macroscopeapp 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.

One finding: invariant documentation was dropped while moving shared eligibility helpers out of apps/server/src/orchestration/decider.ts into packages/contracts/src/messageCorrection.ts. Everything else in the changed Effect code (namespace subpath imports, Context.Service/make/layer shapes, dependency acquisition, no new ManagedRuntime/runPromise outside tests, error construction at the failure boundary) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/web/src/components/ChatView.tsx Resolved

@macroscopeapp macroscopeapp 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.

Reviewed the web UI changes (MessagesTimeline.tsx, ChatView.tsx) for shared-primitive usage, Tailwind ownership, and theming/layout preservation. The new edit action correctly reuses Button/Tooltip/Textarea and mirrors the existing RevertUserMessageButton composition. Two findings on the new inline editor: a viewport-relative min-width that can overflow a narrow chat column, and a surface/foreground token pairing that can lose contrast under custom themes.

Posted via Macroscope — UI Consistency

@macroscopeapp macroscopeapp 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.

One finding on the new inline message editor inside the user message bubble. The shared primitives (Textarea, Button) are used correctly and the Edit affordance mirrors RevertUserMessageButton; the only issue is the ghost Cancel button's hover state on the message surface.

Posted via Macroscope — UI Consistency

@macroscopeapp macroscopeapp 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.

One inline-editor consistency finding on the new message-edit surface in apps/web/src/components/chat/MessagesTimeline.tsx. The rest of the web changes (Button/Textarea primitive usage, ghost Cancel hover treatment, edited-metadata row, and the Revert/Edit mutual exclusion driven by revertTurnCountByUserMessageId) look consistent with the existing chat timeline patterns.

Posted via Macroscope — UI Consistency

@macroscopeapp macroscopeapp 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.

One finding in the new inline message editor: the editor textarea has no height cap, so it can grow past the viewport for the long user messages this row otherwise collapses.

Posted via Macroscope — UI Consistency

@ipanasenko ipanasenko changed the title feat: edit the last user message feat(chat): edit the final user message Aug 16, 2026
Comment thread apps/web/src/components/ChatView.tsx Resolved
sheehanmunim added a commit to munimtechnologies/mtcode that referenced this pull request Aug 18, 2026
sheehanmunim added a commit to munimtechnologies/mtcode that referenced this pull request Aug 18, 2026
Keep the message-correction event as its own union member, project the
correction columns, and match the current thread snapshot/command shape
so the edit-final-message work compiles on personal.

Co-authored-by: Cursor <[email protected]>
@t3dotgg

t3dotgg commented Aug 23, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

Closing this PR after an automated pass over open pull requests. Unfinished message-editing draft spans 51 files and its database migration now conflicts with main.

@t3dotgg t3dotgg closed this Aug 23, 2026
@ipanasenko
ipanasenko deleted the t3code/be0955f1 branch September 2, 2026 08:39
sheehanmunim added a commit to munimtechnologies/mtcode that referenced this pull request Oct 3, 2026
Ports the fork's edit-the-final-message feature (PR pingdotgg#7237, dropped with
the old engine) onto upstream primitives instead of a server command:

- The last user message the user typed gets an Edit action (when its run
  has a rollback checkpoint, disabled while the thread works) that opens
  an inline editor in the bubble. Only the typed text is editable; the
  Ultrathink prefix and structured context blocks are kept.
- Send rolls the thread back to before the message with checkpoint.rollback
  (restoreFiles: false, so it also works in shared workspaces), shows the
  edited text in the bubble meanwhile, then sends the edited message with
  the original attachments and context. If the send fails after the
  rollback, the text returns to the composer.
- Upstream's "Edit from here" (rewind into the composer) is unchanged.

Guard: require lines pin the ChatView wiring, the files-kept rollback, and
the timeline's Edit button and inline editor.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants