Skip to content

fix(web): preserve thread mentions when editing sent messages - #30955

Draft
domvox wants to merge 1 commit into
pingdotgg:mainfrom
domvox:fix/sent-message-thread-mentions-30850
Draft

domvox wants to merge 1 commit into
pingdotgg:mainfrom
domvox:fix/sent-message-thread-mentions-30850

Conversation

@domvox

@domvox domvox commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Problem

Part of #30850: editing an already-sent message through Edit from here loses its thread mention. On current main (9e85538535), the reference is removed entirely: Wait for @Mention baseline target to merge returns as Wait for to merge.

Reproduction on the macOS web dev client:

  1. Pick another thread through the composer's @ picker and send the message.
  2. Wait for the turn to finish, then choose Edit from here on that user message.
  3. Choose Revert and keep changes. The composer should retain the thread reference and its backing metadata.

The dashed unavailable-chip symptom in the issue is reproduced by queued-message editing. That separate path is covered by #30874 and #30889; this PR does not close the issue or duplicate their changes.

Change

Preserve thread references when restoring a sent message after rewind, and restore its saved thread context records into the composer draft with appendReference: false. This retains the original environment/thread identity and allows resend to carry the metadata without adding duplicate references.

Ordinary up-arrow prompt-history recall keeps its existing behavior. References with no backing record remain unresolved rather than receiving invented metadata. A deleted thread retains its saved title and the existing “Thread no longer available” guidance.

Scope and approval

This is a small, focused fix for an obvious data-loss bug in the existing sent-message edit workflow. It changes only the shared web/desktop rewind path, its prompt helper, and focused regression tests. It adds no feature, setting, product default, contract or provider behavior.

The independent queued-edit fixes in #30874 and #30889 touch different files. Machine/environment mention loss during sent-message editing is a pre-existing gap and remains outside this PR's scope.

Verification

  • Regression on main: the restored prompt loses the thread reference. The metadata-restoration mutation also fails independently when reference preservation is kept but record hydration is omitted.
  • vp test run apps/web/src/components/chat/chatViewSend.test.ts apps/web/src/components/chat/composerPromptHistory.test.ts — 20 tests passed in 2 files. Coverage includes restoration into an existing draft, failed rewind leaving the draft untouched, preserved context on save/re-edit, missing records, and unchanged ordinary history recall.
  • vp run check:changed — format, lint, knip, affected typechecks, focused tests and React compiler checks passed.
  • git diff --check — passed.
  • Real web client with isolated .t3 state and free Replay (dev) turns: Cancel leaves the sent message and draft unchanged; rewind, resend and a second edit retain the resolved thread chip. A read-only database check confirmed exactly one saved thread context record on resent messages. Deleting only the disposable target fixture retained its title and showed “Thread no longer available”.
  • Independently reviewed by Claude Code, Opus 5.5 High: no blocking code defects. The published source diff matches that reviewed version.

The before image below was recaptured from a clean source tree at upstream main 9e85538535c8553901351112ab02dd1dd62db5ee, with zero tracked or untracked source changes. The after image shows the same fixture flow with this patch. Screenshots and the interaction video were inspected for privacy; only disposable fixture content is visible.

Clean upstream main With this change
Sent-message edit drops the thread mention Sent-message edit preserves the thread chip

Interaction video: Cancel, rewind, resend and re-edit

Limitations: the packaged Electron app was not run; it shares this web code. Native mobile has no sent-message rewind path and was not changed or tested. Relay/tunnel modes were not separately exercised. Queued edits and machine/environment mentions are not fixed here.

Implemented with GPT-6.1 Sol through the Codex harness in T3 Code. Independently reviewed with Claude Code Opus 5.5 High.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 4, 2026

This branch has not been deployed

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

Labels

size:S 10-29 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.

1 participant