You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): removing a queued edit attachment also removes its chip from the text - #45106
On the phone, removing an attachment while editing a queued message leaves its inline chip in the text.
Steps (Replay (dev) agent, no provider sign-in, mobile app):
Open a thread with a running turn and queue a message: type "look", attach a photo (its chip lands in the text), send.
Tap the queued message to edit it, then tap x on the photo in the strip above the composer.
The thumbnail goes but the chip stays in the text. Tap Save: the queued message, and the turn it later starts, keeps a t3-context://v1/image/<id> reference whose record was dropped. Web shows it as the unavailable chip ("This context is no longer available. Remove it or attach it again.").
Mobile drafts already strip the chip when you remove a thumbnail, and web does the same for queued edits (#40945). Only the mobile queued edit was left out. Open #28483 is related (it keeps image chips out of the mobile composer text) but does not touch this function and would not cover file chips.
Cause
removeQueuedRunEditAttachment in apps/mobile/src/state/queued-run-edit.ts only marks the attachment as removed in existingAttachments. It never touches the edit draft's text or context. On save, resolveQueuedEditPayload drops the removed attachment's context record, but saveQueuedRunEdit still sends draft.text with the chip in it.
Change
removeQueuedRunEditAttachment now calls the existing removeComposerDraftAttachment on the edit's draft key before updating the edit, which removes the chip text and the context record by attachment id. The server attachment is not among the draft's own attachments, so no files are cleaned up. Five lines in one file.
Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New case in apps/mobile/src/state/queued-run-edit.test.ts, "removes a server attachment's chip from the edit text along with its thumbnail": an edit begins with two image chips, one attachment is removed, and the test expects its chip gone from the text and its record gone from the context.
Test commit alone, on main e65c4c3 (fails on main ac0ea0f):
FAIL |unit| src/state/queued-run-edit.test.ts > beginQueuedRunEdit > removes a server attachment's chip from the edit text along with its thumbnail
AssertionError: expected 'look  and "
Tests 1 failed | 14 passed (15)
With the fix, vp test run src/state/queued-run-edit.test.ts in apps/mobile:
Test Files 1 passed (1)
Tests 15 passed (15)
vp run check:changed: format, lint, knip, typecheck (2 packages), test (1 file) and React Compiler (1 file) all pass.
Not verified: I did not run the mobile app on a phone; the unit test drives the same state functions the thumbnail's x button calls.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.
Reviewing files that changed from the base of the PR and between 872ec42 and f515c40.
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
Removing an attachment from a queued edit now also removes its formatted reference and context record from the composer draft. The change preserves other attachment references and returns without changes when no queued edit exists.
Changes: Queued edit attachment removal
Layer / File(s)
Summary
Remove attachment from queued edit apps/mobile/src/state/queued-run-edit.ts, apps/mobile/src/state/queued-run-edit.test.ts
The removal function updates the composer draft before updating the queued edit record. The test checks that the removed attachment’s reference and context record are gone while the other attachment’s reference remains.
Removing an attachment from a queued edit now also removes its chip from the edit text, so saving no longer keeps a reference to a dropped context record. The change is small and covered by a regression test, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: removing a queued edit attachment also removes its inline chip from the text. The changeset adds a call to removeComposerDraftAttachment in removeQueuedRunEditAttachme…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections, with reproduction steps, a root-cause explanation, a linked related issue, and test output for both the …
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 names the main change: removing a queued edit attachment also removes its inline chip from the text. The changeset adds a call to removeComposerDraftAttachment in removeQueuedRunEditAttachment and a test for this behavior. The title is specific, uses the conventional commit format, and matches the objectives.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections, with reproduction steps, a root-cause explanation, a linked related issue, and test output for both the failing and passing runs. It states the model and harness used, as the template asks. The Scope section justifies why no issue is linked, which the template permits for small obvious bugs. Verification states what was not checked on a device. The description is complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between e65c4c3 and 872ec42.
Files selected for processing: 2
apps/mobile/src/state/queued-run-edit.test.ts
apps/mobile/src/state/queued-run-edit.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Android Pixel 9, API 36, 1080x2424, light theme, Gboard; fresh server data per commit. Start Replay Long stream, queue a message containing remove.png and keep.png, open its queued edit, remove remove.png, save, and reopen. Initial uploads and queue creation use the real server APIs; the affected interactions run in the app.
Saved message snapshots: before, after. Both remove the deleted context record and attachment; the head also removes the inline reference.
Not shown:
Photo Library selection and the long-press Queue menu were not driven; equivalent uploaded attachments and queued message state were created through the real server APIs.
iOS was not verified because the scenario runner could not boot its pooled device due to an incompatible device RPC protocol.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the phone, removing an attachment while editing a queued message leaves its inline chip in the text.
Steps (Replay (dev) agent, no provider sign-in, mobile app):
t3-context://v1/image/<id>reference whose record was dropped. Web shows it as the unavailable chip ("This context is no longer available. Remove it or attach it again.").Mobile drafts already strip the chip when you remove a thumbnail, and web does the same for queued edits (#40945). Only the mobile queued edit was left out. Open #28483 is related (it keeps image chips out of the mobile composer text) but does not touch this function and would not cover file chips.
Cause
removeQueuedRunEditAttachmentinapps/mobile/src/state/queued-run-edit.tsonly marks the attachment as removed inexistingAttachments. It never touches the edit draft's text or context. On save,resolveQueuedEditPayloaddrops the removed attachment's context record, butsaveQueuedRunEditstill sendsdraft.textwith the chip in it.Change
removeQueuedRunEditAttachmentnow calls the existingremoveComposerDraftAttachmenton the edit's draft key before updating the edit, which removes the chip text and the context record by attachment id. The server attachment is not among the draft's own attachments, so no files are cleaned up. Five lines in one file.Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New case in
apps/mobile/src/state/queued-run-edit.test.ts, "removes a server attachment's chip from the edit text along with its thumbnail": an edit begins with two image chips, one attachment is removed, and the test expects its chip gone from the text and its record gone from the context.Test commit alone, on main e65c4c3 (fails on main ac0ea0f):
With the fix,
vp test run src/state/queued-run-edit.test.tsinapps/mobile:vp run check:changed: format, lint, knip, typecheck (2 packages), test (1 file) and React Compiler (1 file) all pass.Not verified: I did not run the mobile app on a phone; the unit test drives the same state functions the thumbnail's x button calls.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.