The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): A document whose upload failed can be retried in the composer (#38443)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Mike Olson committed
Nov 18, 2026 at 01:49 UTC
a93e61a3438d43eeee99da857270da2222767cd5
4 files changed
+28
-9
apps/mobile/src/components/ComposerAttachmentStrip.tsx
+3
-1
@@ -215,6 +215,8 @@ function ComposerFileAttachment(
215
const canPreview = isPdfFile(attachment) && props.onPressPreview !== undefined;
216
const sourceIdentifier = `draft-file:${attachment.id}`;
217
const onPressDocument = props.onPressDocument;
218
+ const upload = useComposerAttachmentUploadState(props.environmentId, attachment.id);
219
+ const showsUploadBadge = upload !== undefined && upload.status !== "ready";
220
return (
221
<>
222
<PresentationSource identifier={sourceIdentifier}>
@@ -235,7 +237,7 @@ function ComposerFileAttachment(
237
className={
238
props.compact
239
? "items-center justify-center bg-subtle"
238
- : "items-center justify-center gap-1 bg-subtle px-2"
240
+ : `items-center justify-center gap-1 bg-subtle px-2${showsUploadBadge ? " pb-4" : ""}`
241
}
242
style={style}
243
>
apps/mobile/src/features/threads/ThreadComposer.tsx
+7
-1
@@ -84,6 +84,7 @@ import {
84
composerStripAttachments,
85
type DraftComposerFileAttachment,
86
} from "../../lib/composerImages";
87
+import { composerAttachmentUploadKey } from "../../lib/composerAttachmentUploadQueue";
88
import {
89
buildModelOptions,
90
isModelSelectionUnavailable,
@@ -303,7 +304,6 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
304
draftMessage.trim().length > 0 ||
305
draftAttachments.length > 0 ||
306
(queuedEdit?.existingAttachments.length ?? 0) > 0;
306
- const stripAttachments = composerStripAttachments(draftAttachments);
307
const showStopAction = !hasContent && props.canStopThread && queuedEdit === null;
308
const onResumeQueue = props.onResumeQueue;
309
const [resumingQueue, setResumingQueue] = useState(false);
@@ -321,6 +321,12 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
321
AuthOrchestrationOperateScope,
322
);
323
const uploadStates = useAtomValue(composerAttachmentUploadsAtom);
324
+ const stripAttachments = composerStripAttachments(
325
+ draftAttachments,
326
+ (attachment) =>
327
+ uploadStates[composerAttachmentUploadKey(props.environmentId, attachment.id)]?.status ===
328
+ "failed",
329
+ );
330
const attachmentsUploading =
331
props.connectionState === "connected" &&
332
composerAttachmentsStillUploading({
apps/mobile/src/lib/composerImages.test.ts
+11
-5
@@ -332,10 +332,16 @@ describe("composerStripAttachments", () => {
332
333
it("keeps media beside a document rather than dropping the whole strip", async () => {
334
const { composerStripAttachments } = await import("./composerImages");
335
- expect(composerStripAttachments([doc, image, video] as never).map((a) => a.id)).toEqual([
336
- "img-1",
337
- "vid-1",
338
- ]);
335
+ expect(
336
+ composerStripAttachments([doc, image, video] as never, () => false).map((a) => a.id),
337
+ ).toEqual(["img-1", "vid-1"]);
338
+ });
339
+
340
+ it("shows a document whose upload failed, so it can be retried", async () => {
341
+ const { composerStripAttachments } = await import("./composerImages");
342
+ expect(
343
+ composerStripAttachments([doc, image] as never, (a) => a.id === "doc-1").map((a) => a.id),
344
+ ).toEqual(["doc-1", "img-1"]);
345
});
346
347
it("keeps oversized document-picked images visible while sending them as files", async () => {
@@ -350,7 +356,7 @@ describe("composerStripAttachments", () => {
356
sizeBytes: PROVIDER_SEND_TURN_MAX_IMAGE_BYTES + 1,
357
};
358
353
- expect(composerStripAttachments([oversizedImage])).toEqual([oversizedImage]);
359
+ expect(composerStripAttachments([oversizedImage], () => false)).toEqual([oversizedImage]);
360
expect(isComposerImageAttachment(oversizedImage)).toBe(false);
361
});
362
});
apps/mobile/src/lib/composerImages.ts
+7
-2
@@ -80,15 +80,20 @@ export async function createPastedTextComposerAttachment(input: {
80
81
export type DraftComposerAttachment = DraftComposerImageAttachment | DraftComposerFileAttachment;
82
83
-/** Non-media attachments require chip references; missing references mean lost draft files. */
83
+/**
84
+ * Non-media attachments require chip references; missing references mean lost draft files.
85
+ * A chip cannot retry an upload, so a document whose upload failed joins the strip.
86
+ */
87
export function composerStripAttachments(
88
attachments: ReadonlyArray<DraftComposerAttachment>,
89
+ uploadFailed: (attachment: DraftComposerAttachment) => boolean,
90
): ReadonlyArray<DraftComposerAttachment> {
91
return attachments.filter(
92
(attachment) =>
93
attachment.type === "image" ||
94
imageMimeType(attachment) !== null ||
91
- videoMimeType(attachment) !== null,
95
+ videoMimeType(attachment) !== null ||
96
+ uploadFailed(attachment),
97
);
98
}
99