Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
) {
Expand Down Expand Up @@ -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 &&
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/features/threads/new-task-flow-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/state/thread-outbox-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions apps/mobile/src/state/thread-outbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
Loading