t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Android: any file shared into T3 Code from another app is blocked with "Too much context" (same file via + works)

Open vinicius741 opened this issue 1 week ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. On Android, save any small file to the phone. A 238-byte .json file is enough.
  2. Open the system Files app (Samsung My Files), long-press the file, tap Share, and choose T3 Code.
  3. T3 Code opens a New thread draft with the file chip attached.
  4. Type any text, for example test, and tap Send.

Expected behavior

The message sends with the shared file attached, the same as when the file is attached with the composer's + button.

Actual behavior

Send is blocked with the dialog "Too much context — This draft has too much context to send. Remove some context items and try again." (composerContextSendBlockReason in apps/mobile/src/lib/composerContext.ts, raised from NewTaskDraftScreen.tsx).

The file size makes no difference:

What was attached How Result
238-byte .json Shared from My Files into T3 Code Blocked: "Too much context"
86 KB .json Shared from another app (ACTION_SEND_MULTIPLE, two files) Blocked: "Too much context"
~1.1 MB .json Shared from another app Blocked: "Too much context"
The same 238-byte .json Attached with the composer + button Sends normally

So file attachments work, and the problem is specific to files that arrive through the Android share sheet (the incoming-share import path: incoming-share-model.ts → mergeComposerDraftContentState → restoreMissingComposerFileReferences → attachmentContextRecord).

The dialog's wording points at size, but the check can't be about size here. composerContextSendBlockReason shows that message whenever Schema.is(OrchestrationMessageContext) or the decode fails, and the only size cap is COMPOSER_CONTEXT_MAX_SERIALIZED_CHARS = 16_000_000. I ran the main contracts with [email protected] against the record I'd expect the share import to build:

{
  version: 1,
  records: [{
    version: 1,
    kind: "file",
    contextId: "share-<64 hex>-file-0",
    attachmentId: "share-<64 hex>-file-0",
    label: "test-file-1.json",
    name: "test-file-1.json",
    mimeType: "application/json",
    sizeBytes: 238,
  }],
}

Both the decode and Schema.is accept it, so the draft context the share import really produces must differ from this shape in some way I couldn't see from the source. It may be a stale or unreferenced record left in the persisted New thread draft, or a field the native share parser fills differently.

Two smaller suggestions:

  • The block message could say which record failed, or at least that it's invalid rather than too large. "Too much context" sent me chasing file size for a while.
  • A draft that's blocked this way gives no way to find or clear the hidden bad record.

Impact

Major degradation or frequent failure

Version or commit

Server v0.1.7 (Linux). Android app version not captured; the bug still happens as of 2026-11-18.

Environment

Android (Samsung, One UI), sharing from Samsung My Files and from a third-party app through the standard Android share sheet. Server on Fedora-based Linux.

Workaround

Save the file to the phone, then attach it from the composer with + instead of using Share.

vinicius741 avatar Nov 18 '26 13:11 vinicius741

Android app version: 2.3.0 (Settings › About). Server v0.1.7 on Linux.

vinicius741 avatar Nov 18 '26 13:11 vinicius741

This is the same problem as #28535, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

juliusmarminge avatar Nov 18 '26 13:11 juliusmarminge