Skip to content

fix(mobile): removing a queued edit attachment also removes its chip from the text - #45106

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/queued-edit-removed-attachment-chip
Nov 28, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/queued-edit-removed-attachment-chip

Conversation

@iamshadmantaqi

Copy link
Copy Markdown
Contributor

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):

  1. Open a thread with a running turn and queue a message: type "look", attach a photo (its chip lands in the text), send.
  2. Tap the queued message to edit it, then tap x on the photo in the strip above the composer.
  3. 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 ![kept.png](t3-context://v1/imag…' not to contain '![gone.png](t3-context://v1/image/ctx…'
Received: "look ![kept.png](t3-context://v1/image/ctx-0) and ![gone.png](t3-context://v1/image/ctx-1)"
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.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 28, 2026
@coderabbitai

coderabbitai Bot commented Nov 28, 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 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.

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

Change: Bug fix

Suggested reviewers: yash-singh1

Merge Risk: Minimal · previous review 872ec

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 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 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
Recent review info

Run configuration

Commits

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.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Before After
Recording Recording
1068d8a6c6 f515c40dbe
Removed image chip remains and becomes unavailable after reopening. Removed image chip disappears; keep.png survives saving and reopening.

Seed driver · UI driver

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.

@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 Nov 28, 2026
@juliusmarminge
juliusmarminge merged commit 192276f into pingdotgg:main Nov 28, 2026
56 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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