@devries-cameron20 / t3code Mirror · read-only / commits / 073734c1e9
Fork 0

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 23, 05:30 UTC

fix(web): failed attachment uploads no longer block sending (#20737)

voida6 committed Oct 19, 2026 at 06:07 UTC 073734c1e98bf3cb7cb7b2a68d211d7a9f2dceed
3 files changed +12 -12
apps/web/src/components/ChatView.tsx
+7 -1
@@ -517,7 +517,9 @@ import { useComposerHandleContext } from "../composerHandleContext";
517 import {
518 awaitAttachmentUploads,
519 getUploadedAttachments,
520 + readAttachmentUpload,
521 releaseDraftAttachments,
522 + retryAttachmentUpload,
523 startAttachmentUpload,
524 } from "../lib/attachmentUploadQueue";
525 import { sanitizeThreadErrorMessage } from "~/rpc/transportError";
@@ -6436,7 +6438,11 @@ export default function ChatView(props: ChatViewProps) {
6438 : supportsAttachmentUploads;
6439 if (turnUsesAttachmentUploads && composerAttachmentsSnapshot.length > 0) {
6440 for (const attachment of composerAttachmentsSnapshot) {
6439 - startAttachmentUpload({
6441 + const upload =
6442 + readAttachmentUpload(attachment.id)?.status === "failed"
6443 + ? retryAttachmentUpload
6444 + : startAttachmentUpload;
6445 + upload({
6446 environmentId,
6447 image: attachment,
6448 draftTarget: composerDraftTarget,
apps/web/src/lib/attachmentUploadState.test.ts
+2 -2
@@ -37,7 +37,7 @@ describe("attachmentUploadBlockReason", () => {
37 ).toBe("Attachments still uploading");
38 });
39
40 - it("asks the user to retry or remove failed uploads", () => {
40 + it("leaves send enabled for failed uploads so sending can retry them", () => {
41 expect(
42 attachmentUploadBlockReason({
43 imageIds: ["image-1"],
@@ -46,7 +46,7 @@ describe("attachmentUploadBlockReason", () => {
46 "image-1": { status: "failed", environmentId, reason: "Upload failed" },
47 },
48 }),
49 - ).toBe("Retry or remove the failed attachment");
49 + ).toBeNull();
50 });
51
52 it("does not accept an upload from another environment", () => {
apps/web/src/lib/attachmentUploadState.ts
+3 -9
@@ -32,22 +32,16 @@ export function attachmentUploadBlockReason(input: {
32 readonly environmentId: EnvironmentId;
33 }): string | null {
34 let pending = 0;
35 - let failed = 0;
35
36 for (const imageId of input.imageIds) {
37 const upload = input.uploadsByImageId[imageId];
39 - if (upload?.status === "failed" && upload.environmentId === input.environmentId) {
40 - failed += 1;
41 - } else if (upload?.status !== "ready" || upload.environmentId !== input.environmentId) {
38 + // Send retries failed uploads, so they must not disable it.
39 + if (upload?.status === "failed" && upload.environmentId === input.environmentId) continue;
40 + if (upload?.status !== "ready" || upload.environmentId !== input.environmentId) {
41 pending += 1;
42 }
43 }
44
46 - if (failed > 0) {
47 - return failed === 1
48 - ? "Retry or remove the failed attachment"
49 - : "Retry or remove the failed attachments";
50 - }
45 if (pending > 0) {
46 return pending === 1 ? "Attachment still uploading" : "Attachments still uploading";
47 }