Skip to content

fix(web): pasting a copied file over its reattach marker no longer reports failure - #46970

Merged
juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:wf/find-9c5970fe01e392a2f20019c4
Dec 1, 2026
Merged

juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:wf/find-9c5970fe01e392a2f20019c4

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

Pasting a copied message whose file matched a draft's "attach again" marker restored the file, but also showed an error saying the draft rejected it and to remove the chip or attach it again. The draft store's addFiles now also reports files that replaced a marker (committedIds next to addedIds), and the paste path checks that, so the error only appears when the file really was turned away. The composer's own draft re-read for the same purpose is removed in favour of the store's result.

Related: #38305, #29955

Reproduction on main

Commit 1194aa4d91 (main). The file is restored, but an error says the draft rejected it and tells you to remove the chip or attach the file again. Expected: The paste restores the file and its chip can open the attachment.

  1. Send a message with a file attached.
  2. Attach the same file to the next draft.
  3. Reload the page before the draft file finishes uploading.
  4. Copy the sent message with its attachment.
  5. Paste into the draft where the file says attach again.

The cause is at apps/web/src/components/chat/useComposerContextImport.ts:301. Ran pnpm scenarios:prove scripts/scenarios/reattaching-copied-file-keeps-successful-paste.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expected true to be false in the output.

Evidence

Environment: Linux x64 on a boat.dev VM reset before each run, the repository's own tests.

Proven: the replacement test apps/web/src/components/chat/useComposerContextImport.browser.test.tsx fails at the test commit dbee8c6c3b and passes on the head 7f36f91f73, both on main aa8c7c75af.

Before After
Commit dbee8c6c3b 7f36f91f73
Result failed with "expected "add" to not be called at all" passed

No visual shows the change.

Tests

  • dbee8c6c3b adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed aa8c7c75afb905a59708b69b30cdb37c17b62a8a passed on head.

Not in this change

  • The image import path is unchanged: images have no reattach marker that a pasted image replaces.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5

StiensWout and others added 3 commits December 1, 2026 20:24
Callers read committed ids from the store instead of re-reading the draft.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Dec 1, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7f36f91

Macroscope's review found this PR approvable — Pasting a file that successfully replaces a reattach marker now counts as successful instead of showing a rejection error. Existing attachment limits and duplicate handling remain unchanged.

No code changes detected at b35eae8. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7f36f91 and b35eae8.

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

No actionable comments were generated in the recent review.

Walkthrough

The draft store now returns separate IDs for newly added and committed files. Context imports use committed IDs to determine whether an imported attachment was accepted, including when a file replaces a reattach marker.

Changes: Composer attachment results

Layer / File(s) Summary
Draft store result contract
apps/web/src/composerDraftStore.ts, apps/web/src/composerDraftStore.test.ts
addFiles returns addedIds for appended files and committedIds for appended files and marker replacements. Tests cover accepted files, capacity rejection, and marker replacement.
Context import integration
apps/web/src/components/chat/useComposerContextImport.ts, apps/web/src/components/chat/ChatComposer.tsx, apps/web/src/components/chat/composerThreadImport.test.ts, apps/web/src/components/chat/useComposerContextImport.browser.test.tsx
Context imports check committedIds. ChatComposer passes addComposerFilesToDraft directly. Browser tests cover delayed marker replacement and verify the imported file contents and absence of a toast.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: Minimal · previous review 7f36f

Pasting a copied message's file over a draft's "attach again" marker should no longer show a false rejection error. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix: pasting a copied file over its reattach marker no longer reports a failure. The changeset does this. addFiles now returns committedIds for files that replaced markers, and the…
Description check Passed The description covers the problem, the change, the scope, and the verification. The Problem section names the false error and gives reproduction steps. The Change section explains the committedIds ad…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix: pasting a copied file over its reattach marker no longer reports a failure. The changeset does this. addFiles now returns committedIds for files that replaced markers, and the paste path uses that result to decide whether to show the rejection error. The title is specific and follows the conventional commit format from the template.

Full details: Description check

Explanation

The description covers the problem, the change, the scope, and the verification. The Problem section names the false error and gives reproduction steps. The Change section explains the committedIds addition and the removed draft re-read. The Scope section links related issues #38305 and #29955 but does not say why the fix needs no issue, and it does not state whether the bug is obvious. The Verification section gives a before/after table with a failing and passing test, and states that no visual shows the change. Verification notes the check:changed run, and it states what was not checked, which is the image path. The template asks for the reason a small fix needs no issue, which is missing. The attribution section is extra, but the template asks for the model and harness, so that is covered. The description is mostly complete.

Resolution

Optionally, state why the fix needs no linked issue, or confirm that #38305 and #29955 show the bug. The description is otherwise complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between aa8c7c7 and 7f36f91.

Files selected for processing: 6

  • apps/web/src/components/chat/ChatComposer.tsx
  • apps/web/src/components/chat/composerThreadImport.test.ts
  • apps/web/src/components/chat/useComposerContextImport.browser.test.tsx
  • apps/web/src/components/chat/useComposerContextImport.ts
  • apps/web/src/composerDraftStore.test.ts
  • apps/web/src/composerDraftStore.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 1, 2026
@juliusmarminge
juliusmarminge force-pushed the wf/find-9c5970fe01e392a2f20019c4 branch from a0b2b17 to b35eae8 Compare December 1, 2026 19:57
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

On each fresh database: seed a synthetic project and Replay (dev)/Showcase thread; send notes.txt with 'Please read this file'; attach the same file with upload POSTs held open; reload to obtain its attach-again marker; unblock uploads; hover the sent message and click Copy message; paste its actual context-fragment, plain-text and HTML flavors into the composer; capture the restored chips and rejection status. On head, click the restored chip and view the file contents.

Environment: real web dev app and server, Chromium, 1280×800, light theme, fresh synthetic state, Replay (dev)/Showcase. The scenario drives the file input change and dispatches a paste event containing the app's unmodified Copy message payload.

Before — 2e0b779c18 After — b35eae809c
File restored, but false rejection toast appears. File restored without rejection toast.
Before: restored notes.txt with false rejection toast After: restored notes.txt without rejection toast
Before recording After recording

After: restored chip opens notes.txt contents

Scenario driver

The final base scenario failed at the rejection assertion; the identical head scenario passed and opened the attachment. The proof wrapper terminated after both app reports were saved, so these artifacts were recovered and uploaded directly.

Not shown:

  • Native OS clipboard and Ctrl+V delivery were not exercised: the scenario replayed the app-generated clipboard flavors through a browser paste event.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 1, 2026
@juliusmarminge
juliusmarminge merged commit a143526 into pingdotgg:main Dec 1, 2026
62 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 1, 2026
@StiensWout
StiensWout deleted the wf/find-9c5970fe01e392a2f20019c4 branch December 2, 2026 07:32
imetn added a commit to imetn/t4code that referenced this pull request Dec 2, 2026
Surgically ports 62 upstream Web UI fixes from pingdotgg/t3code
(772e3d4..1e6e7d7) into apps/web and scripts/scenarios while
preserving all 31 locked T4 customizations, T4 branding, and
t4-overrides.css.

Also restores React Compiler compilation for Sidebar by moving the
default new Set(...) parameter inside settleLaunchGroup into the
function body so switching threads produces 0 unaffected row re-renders.

Ported (62 commits):
- 1a08049 (pingdotgg#46481): right-panel launcher keys blocked while context menu open
- 6bdd718 (pingdotgg#46489): Enter restores highlighted stashed prompt (scenario e2e; web code already absorbed)
- 347f551 (pingdotgg#46490): Escape closes open context menu before layer beneath it
- afa3003 (pingdotgg#46487): workflows page uses width of wide window
- a2ba869 (pingdotgg#46485): keep joined emoji whole in screen-reader announcements
- a8ee725 (pingdotgg#46493): holding stash shortcut keeps prompt saved (scenario e2e; web code already absorbed)
- 5048c80 (pingdotgg#46499): Mod+S moves edited queued reply to prompt stash
- 179e6c3 (pingdotgg#46506): holding stash delete shortcut removes one prompt (scenario e2e; web code already absorbed)
- c101437 (pingdotgg#44079): fold PR diff whose header was clicked
- 9b27e5a (pingdotgg#46562): second Mod+T keeps right-panel Add menu shortcuts working
- 62cf1fe (pingdotgg#46592): wait for dialog focus before opening context menu over it
- fda1c30 (pingdotgg#46579): resting on issue row prefetches detail
- 28f0c93 (pingdotgg#46593): slash-command description tooltip closes when modal opens
- 789784b (pingdotgg#46603): keep selected tab in Workflows links
- 2bc37d9 (pingdotgg#46597): / and Mod+F in Settings ignore open context menu
- b21923b (pingdotgg#46640): effort shortcut closes nested Permissions menu in model picker
- a5a39fa (pingdotgg#46641): inline thread details card grows with interface font size
- 36983d6 (pingdotgg#46644): workflow runs open in resizable right panel
- 2ad902f (pingdotgg#46691): Mod+F on PRs page ignores open menu
- 97d727c (pingdotgg#46699): Link pull request dialog closes when leaving thread
- 7a9d213 (pingdotgg#46729): refuse saving edit to deleted project script action
- bdda9ce (pingdotgg#46745): settling open delegated task opens next thread
- 3763606 (pingdotgg#46760): command menu description tooltip closes on composer focus loss
- 00eae4b (pingdotgg#46764): reopen workflow run on first click
- 19094fd (pingdotgg#46765): boring sidebar folder rows offer snooze again
- dec756c (pingdotgg#46766): reopen last workflow run after hiding panel
- 33ce571 (pingdotgg#46777): keep workflow runs open behind tab menus
- a989ee8 (pingdotgg#46779): restore focus after closing workflow run
- 5c42b2e (pingdotgg#46786): reopen closed workflow run tabs
- caec30f (pingdotgg#46792): cancel tab drags when switching threads
- 27cf2cf (pingdotgg#46794): disable empty panel shortcuts as it closes
- d65936e (pingdotgg#46791): reveal all side panel tabs when they fit
- a9daa0b (pingdotgg#46781): right-panel shortcuts ignore presses while menu/dialog open
- 35b6c5f (pingdotgg#46801): dismissing PR checkout toast cancels handoff
- e9da1b0 (pingdotgg#46818): boring sidebar folder row actions keep height and clicks
- 9feac49 (pingdotgg#46855): long PR search preserves grapheme clusters
- acef160 (pingdotgg#46849): find shared voice dictionary by Japanese label
- 19da14d (pingdotgg#46796): scrolled right panel tabs no longer block chat titlebar drag
- 506bc36 (pingdotgg#46853): close guest share and handoff dialogs when leaving thread
- b4fd7ba (pingdotgg#46879): let Escape and app shortcuts pass through terminal font preview
- f5689ae (pingdotgg#46835): long history load errors wrap without timeline horizontal overflow
- 6b64b0c (pingdotgg#46890): focus command dialog popup when search input disabled
- 70c9da7 (pingdotgg#46900): focus PR Author/Labels filter search inputs on keyboard open
- 891bf1a (pingdotgg#46924): late slash results no longer open tooltip after focus leaves
- 80f0f8a (pingdotgg#46930): copying failed message keeps its images
- e9ca942 (pingdotgg#46659): show workflow question kinds only in filter
- aa8c7c7 (pingdotgg#46941): queued message moves to stash only once removed
- 3ea13b6 (pingdotgg#46940): editing answer while image prepares cancels held submit
- a143526 (pingdotgg#46970): pasting copied file over reattach marker no longer reports failure
- b33c330 (pingdotgg#47011): stub addComposerFilesToDraft with new return shape in test
- a0fb9d1 (pingdotgg#46974): Issues Labels/Assignee filters focus search on keyboard open
- cb525f4 (pingdotgg#47029): clicking anywhere on terminal or panel tab activates it
- 498a3b6 (pingdotgg#47022): syncing messages line no longer shifts whole chat
- e903c85 (pingdotgg#47046): pasted messages with thread link keep picture
- 6a13142 (pingdotgg#47013): limit style invalidation during right-panel resize
- cd8961e (pingdotgg#47078): pasting copied file no longer takes preparing screenshot slot
- 8d0fb4b (pingdotgg#47100): stop showing previous Usage period as loading after failure
- 515b8c9 (pingdotgg#47114): Tab from Permissions menu keeps focus inside model picker
- a681dd5 (pingdotgg#47125): middle-clicking file link no longer opens broken tab
- bbde8dc (pingdotgg#44842): use plus icon for project new-thread buttons
- 59af88f (pingdotgg#47105): switching threads no longer re-renders unaffected sidebar rows
- 1e6e7d7 (pingdotgg#47080): Reopen Closed Tab skips workflow runs removed from history

Already absorbed in HEAD (3 commits):
- 20a0e5f (pingdotgg#46927), a684090 (pingdotgg#47026), c557dab (pingdotgg#47076)

Skipped cleanly (3 commits):
- 70224ca (pingdotgg#46712): depends on unported ui/open-popups.tsx (pingdotgg#45341)
- cf475c4 (pingdotgg#47034): depends on unported ui/open-popups.tsx (pingdotgg#45341)
- be3cc6c (pingdotgg#47145): depends on unported fitsWithAllowance/workGroupOverflowAllowance in TimelineWorkGroupRows.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants