fix(mobile): allow starting a task with only an image (#17409)

This commit is contained in:
Claudesaul authored and GitHub committed 2026-10-10 06:37:26 -05:00
1 parent 71f6f1db89
commit 02612c2856
4 files changed
+26 -4

No files matched your search

@@ -1244,7 +1244,7 @@ export function NewTaskDraftScreen(props: {
if (
attachmentBlockReason !== null ||
!modelSelection ||
initialMessageText.length === 0 ||
(initialMessageText.length === 0 && draft.attachments.length === 0) ||
flow.submitting ||
(workspaceMode === "worktree" && !selectedBranchName)
) {
@@ -1397,7 +1397,7 @@ export function NewTaskDraftScreen(props: {
!modelUnavailable &&
Boolean(flow.selectedProject) &&
Boolean(flow.selectedModel) &&
flow.prompt.trim().length > 0 &&
(flow.prompt.trim().length > 0 || flow.attachments.length > 0) &&
isIncomingShareReady &&
!isImportingShare &&
!flow.submitting &&
@@ -1105,7 +1105,8 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
selectedEnvironmentServerConfig,
draft.modelSelection ?? null,
) ?? selectedModel;
if (text.length === 0 || !draftModelSelection) {
// A shared image or file is a task on its own; text is optional.
if ((text.length === 0 && draft.attachments.length === 0) || !draftModelSelection) {
return null;
}
// A saved choice from before the project went no-project must not
+2 -1
View File
@@ -247,7 +247,8 @@ export function isQueuedThreadCreationSendable(message: QueuedThreadMessage): bo
if (!message.creation) {
return false;
}
if (message.text.trim().length === 0 || message.modelSelection === undefined) {
const hasContent = message.text.trim().length > 0 || message.attachments.length > 0;
if (!hasContent || message.modelSelection === undefined) {
return false;
}
return message.creation.workspaceMode !== "worktree" || Boolean(message.creation.branch);
@@ -1430,6 +1430,26 @@ describe("thread outbox", () => {
false,
);
expect(isQueuedThreadCreationSendable(base)).toBe(false);
expect(isQueuedThreadCreationSendable({ ...creationMessage, text: " " })).toBe(false);
expect(
isQueuedThreadCreationSendable({
...creationMessage,
text: "",
attachments: [
{
id: "image-1",
type: "image",
name: "photo.png",
mimeType: "image/png",
sizeBytes: 3,
fileUri: "file:///documents/t3-composer-attachments/photo.png",
previewUri: "file:///documents/t3-composer-attachments/photo.png",
uploadedAttachmentId: "pending-photo-png",
uploadEnvironmentId: EnvironmentId.make("environment-1"),
},
],
}),
).toBe(true);
});
it("retries transport failures but drops deterministic command failures", () => {