The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 14:45 UTC
fix(mobile): a shared file no longer fails to send with "Too much context" (#28535)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Derek Trimm committed
Nov 14, 2026 at 06:45 UTC
d9973dc3f8388aa800167670d657369533e0b4c6
3 files changed
+42
-8
apps/mobile/src/features/sharing/incoming-share-model.test.ts
+4
-4
@@ -54,7 +54,7 @@ describe("incoming native shares", () => {
54
text: "Please explain this error\n\nhttps://example.com/issue/1",
55
attachments: [
56
{
57
- id: "share-1:image:3",
57
+ id: "share-1-image-3",
58
type: "image",
59
name: "Screenshot.png",
60
mimeType: "image/png",
@@ -131,7 +131,7 @@ describe("incoming native shares", () => {
131
132
expect(result.attachments).toEqual([
133
{
134
- id: "share-report:file:0",
134
+ id: "share-report-file-0",
135
type: "file",
136
name: "report.pdf",
137
mimeType: "application/pdf",
@@ -165,7 +165,7 @@ describe("incoming native shares", () => {
165
expect(result.warnings).toEqual([]);
166
expect(result.attachments).toEqual([
167
{
168
- id: "share-video:file:0",
168
+ id: "share-video-file-0",
169
type: "file",
170
name: video.originalName,
171
mimeType: video.mimeType,
@@ -239,7 +239,7 @@ describe("incoming native shares", () => {
239
240
expect(result.attachments).toEqual([
241
{
242
- id: "share-android-report:file:0",
242
+ id: "share-android-report-file-0",
243
type: "file",
244
name: "report",
245
mimeType: "application/pdf",
apps/mobile/src/features/sharing/incoming-share-model.ts
+2
-2
@@ -332,7 +332,7 @@ export async function buildIncomingShareDraft(input: {
332
}
333
}
334
attachments.push({
335
- id: `${input.id}:file:${index}`,
335
+ id: `${input.id}-file-${index}`,
336
type: "file",
337
name,
338
mimeType,
@@ -397,7 +397,7 @@ export async function buildIncomingShareDraft(input: {
397
}
398
const dataUrl = `data:${mimeType};base64,${base64}`;
399
attachments.push({
400
- id: `${input.id}:image:${index}`,
400
+ id: `${input.id}-image-${index}`,
401
type: "image",
402
name: resolved?.originalName ?? fallbackName(uri, index, mimeType),
403
mimeType,
apps/mobile/src/state/use-composer-drafts.test.ts
+36
-2
@@ -28,6 +28,9 @@ import {
28
} from "@t3tools/contracts";
29
import { onTestFinished, vi } from "vite-plus/test";
30
31
+import { buildIncomingShareDraft } from "../features/sharing/incoming-share-model";
32
+import { composerContextSendBlockReason } from "../lib/composerContext";
33
+
34
const composerDraftFileMocks = vi.hoisted(() => {
35
let document = JSON.stringify({ schemaVersion: 1, drafts: {} });
36
let readError: Error | null = null;
@@ -2236,7 +2239,7 @@ describe("mobile composer drafts", () => {
2239
it("merges shared content into a project draft without duplicating retries", () => {
2240
const draftKey = "new-task:environment-1:project-1";
2241
const sharedAttachment = {
2239
- id: "share-1:image:0",
2242
+ id: "share-1-image-0",
2243
type: "image" as const,
2244
name: "Screenshot.png",
2245
mimeType: "image/png",
@@ -2271,7 +2274,7 @@ describe("mobile composer drafts", () => {
2274
it("shows a shared non-image file as a composer chip", () => {
2275
const draftKey = "new-task:environment-1:project-1";
2276
const sharedFile = {
2274
- id: "share-1:file:0",
2277
+ id: "share-1-file-0",
2278
type: "file" as const,
2279
name: "backup.json",
2280
mimeType: "application/json",
@@ -2306,6 +2309,37 @@ describe("mobile composer drafts", () => {
2309
expect(mergeComposerDraftContentState(once, draftKey, recovered)).toBe(once);
2310
});
2311
2312
+ it("lets a shared file through the send check", async () => {
2313
+ const { attachments } = await buildIncomingShareDraft({
2314
+ id: "share-1",
2315
+ createdAt: "2026-07-15T10:00:00.000Z",
2316
+ payloads: [
2317
+ {
2318
+ shareType: "file",
2319
+ value: "file:///shared/report.xlsx",
2320
+ mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2321
+ originalName: "report.xlsx",
2322
+ },
2323
+ ],
2324
+ resolvedPayloads: [],
2325
+ fileReader: {
2326
+ readBase64: async () => "",
2327
+ readSize: async () => 42,
2328
+ removeOwnedFile: async () => {},
2329
+ },
2330
+ });
2331
+ const draftKey = "new-task:environment-1:project-1";
2332
+
2333
+ const merged = mergeComposerDraftContentState({}, draftKey, {
2334
+ text: "",
2335
+ attachments,
2336
+ sourceShareId: "share-1",
2337
+ })[draftKey]!;
2338
+
2339
+ expect(merged.context?.records).toHaveLength(1);
2340
+ expect(composerContextSendBlockReason(merged.context)).toBeNull();
2341
+ });
2342
+
2343
it("preserves existing images when shared content exceeds the draft attachment limit", () => {
2344
const draftKey = "new-task:environment-1:project-1";
2345
const image = (id: string) => ({