fix(web): keep one file chip when restoring a reattach marker #48081
main fromrefs/pull/48081/head·opened View on GitHubProblem#
Restoring a stashed file can leave two prompt chips for one attachment. This happens when the draft has a matching reattach marker and both the draft and the stash contain a chip for the file.
Change#
Remove the duplicate stashed chip before the draft store rewrites the existing marker to point to the verified file. The remaining chip stays in the draft's original position.
Scope#
Small bug fix in the shared web and Electron composer. The duplicate has a deterministic reproduction, so a separate issue is unnecessary.
Verification#
- The Chromium regression failed on upstream
6b12843cbe5cwith two chips. All 21 stash browser tests andvp run check:changedpassed on96c8eb491066in InstaBox. - The isolated Replay client reproduced the bug with a server-verified upload. The fix kept one attachment and one chip in the original position.
| Before | After |
|---|---|
![]() | ![]() |
Authored by GPT-6.2 Sol in Codex.
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
No actionable comments were generated in the recent review.
Walkthrough
-
File restoration now targets prompt context cleanup to selected stashed file IDs and capacity-skipped files. Browser tests cover attached, expired, and reattached file states.
Changes: Composer stash restoration
Layer / File(s) Summary Targeted file-chip cleanup and browser coverage
apps/web/src/components/chat/useComposerStash.ts,apps/web/src/components/chat/useComposerStash.browser.test.tsxThe hook collects context IDs from the current prompt and tracks stashed file chip IDs selected for removal during restoration. Cleanup removes references for those IDs and capacity-skipped files. Browser tests check the retained file ID and prompt context reference across attached, expired, and reattached states. Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
iamshadmantaqi,stienswout
Merge Risk:
Minimal · up to96c8e-
This fixes duplicate attachment chips when restoring a stashed file, and the added browser tests cover the affected states. No merge-blocking risk was identified.
Pre-merge checks:
4-
Check name Status Explanation Title check The title "fix(web): keep one file chip when restoring a reattach marker" matches the main change. The PR removes a duplicate stashed file chip during restore when a draft has a matching reattach mark… Description check The description follows the template well. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and reproduction conditions. The Change section explains the f… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(web): keep one file chip when restoring a reattach marker" matches the main change. The PR removes a duplicate stashed file chip during restore when a draft has a matching reattach marker, so only one chip remains. The title is specific and uses a conventional commit format.
Full details: Description check
-
Explanation
The description follows the template well. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and reproduction conditions. The Change section explains the fix. The Scope section says why no issue is needed. The Verification section lists focused test runs and a before/after comparison with screenshots. The template's trailing agent-attribution line is present as 'Authored by GPT-6.2 Sol in Codex.' The title is not restated in the template's opening comment, but that comment is guidance, not required content. Minor gap: the Scope section does not link a maintainer request, which the template only requires when one exists.
-
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-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 23c6d11
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
80d2ab18-fb6f-46e3-9899-f7a1b27ace48
Commits-
Reviewing files that changed from the base of the PR and between 23c6d11d9eb5c6ecfad231411a16508e5ac6845a and 96c8eb49106625f8729e50d33538432a162193c5.
Files selected for processing: 2-
apps/web/src/components/chat/useComposerStash.browser.test.tsxapps/web/src/components/chat/useComposerStash.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
-
Sign in to join this conversation.


Approvability#
Verdict: Approved at
96c8eb4Macroscope's review found this PR approvable — Restoring a stashed file now keeps one chip when replacing an existing reattach marker. The change is limited to draft references and leaves attachment lifecycle behavior unchanged.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).