Repository navigation
fix(mobile): a shared file no longer fails to send with "Too much context" - #28535
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — New mobile share attachments use hyphen-separated IDs compatible with the attachment contract. The change leaves attachment content, limits, and access behavior unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Left on behalf of Hal by Opus 5.5 +1. Hal hit this today on an iPhone sharing a WhatsApp voice note to T3 Code: the chip appeared, then send gave the "Too much context" dialog. Saving the note to Files and attaching it with the + button sent fine, which fits the colon-id explanation, since picker attachments get UUIDs. So it catches audio too, not just documents. Traced it on current main (55081a1) and got to the same cause: |
EvidenceOn pooled Android Pixel 9/API 36, download report.pdf, cancel the viewer prompt, then Files → long-press → Share → T3 Code Dev → Share evidence → Send. Repeat with chart.png. Each commit ran its own Metro bundle and isolated server. PDF: base rejects the 7 KB file; head sends it and completes. Image: both commits complete successfully.
Commands and synthetic fixtures · Capture notes and discarded attempts. The head PDF still and video show the same 12:22 PM send and completed replay. Image captures show matching recorded sends at 12:29 PM on base and 12:36 PM on head. Images use a separate replay fixture advertising image support because stock Replay advertises image:false. Environment labels are redacted; video timing is unchanged, with a two-second final-frame hold. No tests are used as evidence. Not shown:
|




Problem
Sharing a non-image file into T3 Code from the system share sheet (a spreadsheet, PDF or audio file) leaves a draft that cannot be sent. The chip appears, and pressing send shows:
The file's size has nothing to do with it. Shared attachments get ids like
share-<sha256>:file:0, and theattachmentIdon a composer context record only allows[a-z0-9_-]. The colons failOrchestrationMessageContext, andcomposerContextSendBlockReasonreports every validation failure with that message.Since #21659, a shared file gets a context record so that it shows as a chip. That record carries the colon id, so every such draft is blocked before upload. Files added with the attachment button are unaffected because their ids are UUIDs. Images and videos are unaffected because they get no file record.
Change
buildIncomingShareDraftnow builds-file-and-image-ids, which are valid for bothChatAttachmentIdand the context schema. Image ids change too, so that both share paths produce a valid id. Nothing parses the old format.Scope and approval
A very small fix for an obvious bug: a shipped feature fails every time on its normal path. The source change is the separator in two template strings, plus test fixtures that pinned the old format. There is no prior issue. Search for the error text and the functions involved found no existing report or fix.
#27878 edits the same two lines and keeps the colons, so whichever lands second needs a small rebase.
Verification
Found on an iPhone by sharing a spreadsheet into a new thread, which showed the dialog above.
Reproduced on an iOS 27.0 Simulator (Xcode 27.2) through the real share path: Files, Share, T3 Code Dev, then Send. Both runs used the same
Sample Report.xlsx, the same steps, the same dev client and an isolated server with ademo-appproject. Only the id separator changed, and I confirmed it in the bundle Metro served before each run.:file:)-file-)Recordings: before and after.
The after run used the Replay provider, so the agent text in those captures is canned. What it shows is the send: no dialog, and the file appears in the thread. The server stored the upload, and its SHA-256 matches the original file.
lets a shared file through the send checkruns a shared.xlsxpayload through the realbuildIncomingShareDraft,mergeComposerDraftContentStateandcomposerContextSendBlockReason. On currentmainwithout the source change it fails withexpected 'This draft has too much context to se…' to be null. With the change it passes.vp test run src/state/use-composer-drafts.test.ts src/features/sharing src/lib/composerContext.test.tsfromapps/mobile: 133 passed.check:changedpasses: format, lint, knip, typecheck, tests and React Compiler.Not checked: a physical device with the fix, and Android. The failing code is not platform-specific.
A draft or inbox share saved before this fix keeps its old id and stays blocked until the chip is removed and the file is shared again. I left that out, because the stored state only exists after a failed attempt and the dialog already leads to that recovery.
Made with Claude Opus 5.5 in Claude Code, running in T3 Code.