From c121a5542fa7eb47fbf83e2e7aec223a46400744 Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Wed, 4 Nov 2026 10:39:14 +1100 Subject: [PATCH 1/9] fix(mobile): a thread's goal pill can be cleared or resumed The goal pill was read-only, so clearing a goal meant typing /goal clear by hand. It now carries Clear, and Resume where the web client shows it, sent as a standalone queued command without touching the composer draft. --- .../features/threads/NewTaskDraftScreen.tsx | 1 + .../features/threads/ThreadDetailScreen.tsx | 40 ++++++++++++- .../features/threads/ThreadRouteScreen.tsx | 1 + .../threads/floating-working-control.tsx | 56 +++++++++++-------- .../threads/floating-working-status.ts | 7 ++- .../src/state/thread-task-permissions.test.ts | 25 +++++++++ .../src/state/use-thread-composer-state.ts | 51 +++++++++++++++++ 7 files changed, 155 insertions(+), 26 deletions(-) diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx index a3b02b8985d4..9b8a25073083 100644 --- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx +++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx @@ -970,6 +970,7 @@ export function NewTaskDraftScreen(props: { onResumeQueue={null} onSendMessage={handleStart} offersSideChat={false} + onSendCommand={async () => null} onReconnectEnvironment={() => onReconnectEnvironment(selectedProject.environmentId)} canSwitchThreadProvider onRespondToApproval={async () => {}} diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index f3c81cc9b136..4de44f2450e0 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -184,7 +184,11 @@ import { FLOATING_WORKING_CONTROL_COVERAGE, FloatingWorkingControl, } from "./floating-working-control"; -import { connectionFloatingStatus, type FloatingWorkingStatus } from "./floating-working-status"; +import { + connectionFloatingStatus, + type FloatingStatusAction, + type FloatingWorkingStatus, +} from "./floating-working-status"; import { derivePendingUserInputMaxHeight, ESTIMATED_KEYBOARD_HEIGHT, @@ -298,6 +302,8 @@ export interface ThreadDetailScreenProps { ) => Promise, onWillEnqueue?: () => void, ) => Promise; + /** Queues a standalone text command, such as `/goal clear`, without touching the draft. */ + readonly onSendCommand: (text: string) => Promise; readonly onReconnectEnvironment: () => void; readonly canSwitchThreadProvider: boolean; readonly onRespondToApproval: ApprovalResponder; @@ -732,6 +738,18 @@ function ThreadDetailBody( ); } }; + const [goalCommandPending, setGoalCommandPending] = useState(false); + const runGoalCommand = async (command: string) => { + if (goalCommandPending || !props.canOperateThread) return; + setGoalCommandPending(true); + try { + await props.onSendCommand(command); + } catch (error) { + Dialog.alert("Could not update goal", error instanceof Error ? error.message : "Try again."); + } finally { + setGoalCommandPending(false); + } + }; const pendingBackgroundWork = presentPendingBackgroundWork( props.selectedThread.pendingBackgroundTasks, ); @@ -864,11 +882,31 @@ function ThreadDetailBody( }; } if (props.selectedThread.goal !== null && contentPresentationKind === "ready") { + // The pill only shows while idle, so Resume never interrupts running work. const goal = presentProviderGoal(props.selectedThread.goal, false); + // Claude goals can only be cleared; the server rejects `/goal resume` there. + const goalProvider = props.serverConfig?.providers.find( + (provider) => provider.instanceId === props.selectedThread.modelSelection.instanceId, + ); + const canResumeGoal = goal.canResume && goalProvider?.driver !== "claudeAgent"; + const goalAction = ( + label: string, + accessibilityLabel: string, + command: string, + ): FloatingStatusAction => ({ + label, + accessibilityLabel, + disabled: !props.canOperateThread || goalCommandPending, + onPress: () => void runGoalCommand(command), + }); return { kind: "goal", label: goal.title, accessibilityLabel: `${goal.title}: ${goal.objective}`, + actions: [ + ...(canResumeGoal ? [goalAction("Resume", "Resume goal", "/goal resume")] : []), + goalAction("Clear", "Clear goal", "/goal clear"), + ], }; } if (extensionStatus !== null && contentPresentationKind === "ready") { diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index 365d6d584c29..ccc580d5c933 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -1061,6 +1061,7 @@ function ThreadRouteContent( } onSendMessage={composer.onSendMessage} offersSideChat={composer.sideChatUnavailableReason === null} + onSendCommand={composer.onSendCommand} onReconnectEnvironment={handleReconnectEnvironment} canSwitchThreadProvider={composer.canSwitchThreadProvider} onRespondToApproval={requests.onRespondToApproval} diff --git a/apps/mobile/src/features/threads/floating-working-control.tsx b/apps/mobile/src/features/threads/floating-working-control.tsx index a41fc2b3de39..5067301ed768 100644 --- a/apps/mobile/src/features/threads/floating-working-control.tsx +++ b/apps/mobile/src/features/threads/floating-working-control.tsx @@ -1,7 +1,7 @@ import type { SubagentPillSegment } from "@t3tools/client-runtime/state/thread-subagents"; import { formatDuration } from "@t3tools/shared/orchestrationTiming"; import { GlassContainer, GlassView } from "expo-glass-effect"; -import { type ReactNode, useEffect, useRef, useState } from "react"; +import { Fragment, type ReactNode, useEffect, useRef, useState } from "react"; import { type LayoutChangeEvent, Pressable, @@ -29,7 +29,7 @@ import { ControlPill } from "../../components/ui/ControlPill"; import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass"; import { BrowserPreviewButton } from "../browser/browser-preview-button"; import { DevicePreviewButton } from "../devices/device-preview-button"; -import type { FloatingWorkingStatus } from "./floating-working-status"; +import type { FloatingStatusAction, FloatingWorkingStatus } from "./floating-working-status"; import { ShimmeringWorkContent } from "./thread-work-log"; import { useVisibleSecondClock } from "./use-visible-second-clock"; @@ -89,12 +89,16 @@ export function FloatingWorkingControl(props: { const extensionStatus = props.extensionStatus ?? null; const extensionOnly = props.status?.kind === "extension"; const useGlass = NATIVE_LIQUID_GLASS_SUPPORTED && !extensionOnly; - const action = - props.status?.kind === "background" || - props.status?.kind === "lifecycle" || - props.status?.kind === "stop" - ? props.status.action - : null; + const actions: ReadonlyArray = + props.status?.kind === "goal" + ? props.status.actions + : props.status?.kind === "background" || + props.status?.kind === "lifecycle" || + props.status?.kind === "stop" + ? props.status.action === null + ? [] + : [props.status.action] + : []; const [agentsWidth, setAgentsWidth] = useState(0); const hasQueue = props.queuedCount > 0; const hasPreview = props.devicePreview !== null || props.browserPreview !== null; @@ -107,7 +111,7 @@ export function FloatingWorkingControl(props: { 0, Math.min(overlayWidth, windowWidth) - reservedWidth - - (action !== null ? actionWidth : 0) - + (actions.length > 0 ? actionWidth : 0) - (hasQueue ? queueWidth : 0) - (hasAgents ? agentsWidth : 0) - (hasPreview ? previewWidth : 0), @@ -179,7 +183,7 @@ export function FloatingWorkingControl(props: { const capsuleInteractive = statusInteractive || extensionStatus !== null || - action !== null || + actions.length > 0 || hasQueue || hasAgents || hasPreview; @@ -229,24 +233,28 @@ export function FloatingWorkingControl(props: { ) : null} - {action !== null ? ( + {actions.length > 0 ? ( setActionWidth(settleWidth(event.nativeEvent.layout.width))} className="h-11 flex-row items-center" > - - - - {action.label} - - + {actions.map((action) => ( + + + + + {action.label} + + + + ))} ) : null} {hasPreview ? ( diff --git a/apps/mobile/src/features/threads/floating-working-status.ts b/apps/mobile/src/features/threads/floating-working-status.ts index e3c137ebfd25..9225bbfa0803 100644 --- a/apps/mobile/src/features/threads/floating-working-status.ts +++ b/apps/mobile/src/features/threads/floating-working-status.ts @@ -37,7 +37,12 @@ export type FloatingWorkingStatus = readonly unresponsive: boolean; readonly action: FloatingStatusAction | null; } - | { readonly kind: "goal"; readonly label: string; readonly accessibilityLabel: string } + | { + readonly kind: "goal"; + readonly label: string; + readonly accessibilityLabel: string; + readonly actions: ReadonlyArray; + } | { readonly kind: "extension"; readonly label: string; readonly onPress: () => void } | { readonly kind: "preparing"; readonly label: string } | { diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index 5a31c1955b92..d485fbeef81f 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -416,6 +416,31 @@ describe("mobile task permissions", () => { ); }); + it("queues a goal command without sending or clearing the composer draft", async () => { + state.grantedEnvironments.add("secondary"); + const composer = useThreadComposerState(); + expect(await composer.onSendCommand("/goal clear")).toBe("message"); + expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( + expect.objectContaining({ + environmentId: "secondary", + threadId: "thread", + text: "/goal clear", + attachments: [], + modelSelection: state.thread.modelSelection, + }), + ); + expect(state.clearDraft).not.toHaveBeenCalled(); + expect(state.draft.text).toBe("Keep my draft"); + }); + + it("rechecks the operate grant before queueing a command", async () => { + state.grantedEnvironments.add("secondary"); + const composer = useThreadComposerState(); + state.grantedEnvironments.delete("secondary"); + expect(await composer.onSendCommand("/goal clear")).toBeNull(); + expect(state.enqueue).not.toHaveBeenCalled(); + }); + it("rechecks the target environment before an approval response", async () => { state.grantedEnvironments.add("secondary"); const requests = useSelectedThreadRequests(); diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts index 465a8a425d29..527e9516bb2f 100644 --- a/apps/mobile/src/state/use-thread-composer-state.ts +++ b/apps/mobile/src/state/use-thread-composer-state.ts @@ -817,6 +817,56 @@ export function useThreadComposerState(input: { return null; })(); + /** Queues a standalone text command such as `/goal clear` and leaves the composer draft alone. */ + const onSendCommand = async (text: string) => { + if ( + !selectedThreadShell || + selectedThreadCreation !== null || + (selectedEnvironmentRuntime?.connectionState === "connected" && + !readEnvironmentScope(selectedThreadShell.environmentId, AuthOrchestrationOperateScope)) + ) { + return null; + } + const thread = selectedThreadShell; + const threadKey = scopedThreadKey(thread.environmentId, thread.id); + const draft = getComposerDraftSnapshot(threadKey); + const modelSelection = draft.modelSelection ?? thread.modelSelection; + const serverConfig = selectedEnvironmentRuntime?.serverConfig; + if ( + selectedEnvironmentRuntime?.connectionState === "connected" && + isModelSelectionUnavailable(serverConfig, modelSelection, thread.projectId) + ) { + const { title, detail } = describeUnavailableModelSelection( + serverConfig, + modelSelection, + thread.projectId, + ); + Dialog.alert(title, detail); + return null; + } + const provider = serverConfig?.providers.find( + (entry) => entry.instanceId === modelSelection.instanceId, + ); + const metadata = makeQueuedMessageMetadata(); + const messageId = MessageId.make(metadata.messageId); + await enqueueThreadOutboxMessage({ + environmentId: thread.environmentId, + threadId: thread.id, + messageId, + commandId: CommandId.make(metadata.commandId), + text, + attachments: [], + modelSelection, + runtimeMode: draft.runtimeMode ?? thread.runtimeMode, + interactionMode: resolveProviderInteractionMode( + provider, + draft.interactionMode ?? thread.interactionMode, + ), + createdAt: metadata.createdAt, + }); + return messageId; + }; + const onChangeDraftMessage = (value: string) => { if (!selectedThreadShell) { return; @@ -879,6 +929,7 @@ export function useThreadComposerState(input: { onNativePasteText, onRemoveDraftImage, onSendMessage, + onSendCommand, sideChatUnavailableReason, }; } From 3d2ff0dd7f9af12457aaf26151348f645fde920c Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Wed, 4 Nov 2026 11:29:49 +1100 Subject: [PATCH 2/9] fix(mobile): goal commands use the thread's model and compile under React Compiler A draft model override could send /goal resume to the wrong provider, and the try/finally in the goal handler blocked React Compiler. --- .../mobile/src/features/threads/ThreadDetailScreen.tsx | 4 ++-- apps/mobile/src/state/thread-task-permissions.test.ts | 10 ++++++++++ apps/mobile/src/state/use-thread-composer-state.ts | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 4de44f2450e0..4eb30d05e37b 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -742,13 +742,13 @@ function ThreadDetailBody( const runGoalCommand = async (command: string) => { if (goalCommandPending || !props.canOperateThread) return; setGoalCommandPending(true); + // No `finally`: React Compiler cannot lower it. try { await props.onSendCommand(command); } catch (error) { Dialog.alert("Could not update goal", error instanceof Error ? error.message : "Try again."); - } finally { - setGoalCommandPending(false); } + setGoalCommandPending(false); }; const pendingBackgroundWork = presentPendingBackgroundWork( props.selectedThread.pendingBackgroundTasks, diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index d485fbeef81f..064704f2439d 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -433,6 +433,16 @@ describe("mobile task permissions", () => { expect(state.draft.text).toBe("Keep my draft"); }); + it("sends a goal command with the thread's model, not the draft's", async () => { + state.grantedEnvironments.add("secondary"); + state.draft.modelSelection = { instanceId: "claudeAgent", model: "claude-sonnet-5-5" }; + const composer = useThreadComposerState(); + await composer.onSendCommand("/goal resume"); + expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( + expect.objectContaining({ modelSelection: state.thread.modelSelection }), + ); + }); + it("rechecks the operate grant before queueing a command", async () => { state.grantedEnvironments.add("secondary"); const composer = useThreadComposerState(); diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts index 527e9516bb2f..d18e36f6df28 100644 --- a/apps/mobile/src/state/use-thread-composer-state.ts +++ b/apps/mobile/src/state/use-thread-composer-state.ts @@ -830,7 +830,8 @@ export function useThreadComposerState(input: { const thread = selectedThreadShell; const threadKey = scopedThreadKey(thread.environmentId, thread.id); const draft = getComposerDraftSnapshot(threadKey); - const modelSelection = draft.modelSelection ?? thread.modelSelection; + // Goal commands belong to the provider that owns the goal, not a model picked in the draft. + const modelSelection = thread.modelSelection; const serverConfig = selectedEnvironmentRuntime?.serverConfig; if ( selectedEnvironmentRuntime?.connectionState === "connected" && From e2ce03a12459e1be1a66775e5841c63d878f6f77 Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Wed, 4 Nov 2026 11:38:49 +1100 Subject: [PATCH 3/9] test(mobile): brand the provider instance id in the goal command test --- apps/mobile/src/state/thread-task-permissions.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index 064704f2439d..2cdbfc78a241 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -435,7 +435,10 @@ describe("mobile task permissions", () => { it("sends a goal command with the thread's model, not the draft's", async () => { state.grantedEnvironments.add("secondary"); - state.draft.modelSelection = { instanceId: "claudeAgent", model: "claude-sonnet-5-5" }; + state.draft.modelSelection = { + instanceId: ProviderInstanceId.make("claudeAgent"), + model: "claude-sonnet-5-5", + }; const composer = useThreadComposerState(); await composer.onSendCommand("/goal resume"); expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( From 44ad6da5887a69896380f3327cbfeb81f0c46cf6 Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Fri, 6 Nov 2026 10:07:27 +1100 Subject: [PATCH 4/9] test(mobile): goal command tests pass the side-chat input --- apps/mobile/src/state/thread-task-permissions.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index 2cdbfc78a241..124f9a5dbba6 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -418,7 +418,7 @@ describe("mobile task permissions", () => { it("queues a goal command without sending or clearing the composer draft", async () => { state.grantedEnvironments.add("secondary"); - const composer = useThreadComposerState(); + const composer = useThreadComposerState(NO_SIDE_CHATS); expect(await composer.onSendCommand("/goal clear")).toBe("message"); expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( expect.objectContaining({ @@ -439,7 +439,7 @@ describe("mobile task permissions", () => { instanceId: ProviderInstanceId.make("claudeAgent"), model: "claude-sonnet-5-5", }; - const composer = useThreadComposerState(); + const composer = useThreadComposerState(NO_SIDE_CHATS); await composer.onSendCommand("/goal resume"); expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( expect.objectContaining({ modelSelection: state.thread.modelSelection }), @@ -448,7 +448,7 @@ describe("mobile task permissions", () => { it("rechecks the operate grant before queueing a command", async () => { state.grantedEnvironments.add("secondary"); - const composer = useThreadComposerState(); + const composer = useThreadComposerState(NO_SIDE_CHATS); state.grantedEnvironments.delete("secondary"); expect(await composer.onSendCommand("/goal clear")).toBeNull(); expect(state.enqueue).not.toHaveBeenCalled(); From 094ecfb2180df3fa50c0a196e88aab7d68311016 Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Fri, 6 Nov 2026 10:21:23 +1100 Subject: [PATCH 5/9] fix(mobile): goal actions stay hidden while a run is queued A queued run is busy but has no work start time, so the idle check let Clear and Resume through. --- apps/mobile/src/features/threads/ThreadDetailScreen.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 4eb30d05e37b..7242fc37db89 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -881,8 +881,13 @@ function ThreadDetailBody( }, }; } - if (props.selectedThread.goal !== null && contentPresentationKind === "ready") { - // The pill only shows while idle, so Resume never interrupts running work. + if ( + props.selectedThread.goal !== null && + !props.activeThreadBusy && + contentPresentationKind === "ready" + ) { + // The pill only shows while idle (a queued run is busy but has no work start time), so + // Resume never interrupts running work. const goal = presentProviderGoal(props.selectedThread.goal, false); // Claude goals can only be cleared; the server rejects `/goal resume` there. const goalProvider = props.serverConfig?.providers.find( From b160b7d7169c4e2600d6b954318e69c5c33a08e3 Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Fri, 6 Nov 2026 10:40:42 +1100 Subject: [PATCH 6/9] fix(mobile): goal commands use the thread's runtime and interaction mode A draft in plan mode or a stricter runtime mode no longer rides along with Clear and Resume. --- apps/mobile/src/state/thread-task-permissions.test.ts | 9 +++++++-- apps/mobile/src/state/use-thread-composer-state.ts | 11 +++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index 124f9a5dbba6..9d84552a3aae 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -433,16 +433,21 @@ describe("mobile task permissions", () => { expect(state.draft.text).toBe("Keep my draft"); }); - it("sends a goal command with the thread's model, not the draft's", async () => { + it("sends a goal command with the thread's model and modes, not the draft's", async () => { state.grantedEnvironments.add("secondary"); state.draft.modelSelection = { instanceId: ProviderInstanceId.make("claudeAgent"), model: "claude-sonnet-5-5", }; + Object.assign(state.draft, { runtimeMode: "approval-required", interactionMode: "plan" }); const composer = useThreadComposerState(NO_SIDE_CHATS); await composer.onSendCommand("/goal resume"); expect(state.enqueue).toHaveBeenCalledExactlyOnceWith( - expect.objectContaining({ modelSelection: state.thread.modelSelection }), + expect.objectContaining({ + modelSelection: state.thread.modelSelection, + runtimeMode: state.thread.runtimeMode, + interactionMode: state.thread.interactionMode, + }), ); }); diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts index d18e36f6df28..cc6e27839e6c 100644 --- a/apps/mobile/src/state/use-thread-composer-state.ts +++ b/apps/mobile/src/state/use-thread-composer-state.ts @@ -828,9 +828,7 @@ export function useThreadComposerState(input: { return null; } const thread = selectedThreadShell; - const threadKey = scopedThreadKey(thread.environmentId, thread.id); - const draft = getComposerDraftSnapshot(threadKey); - // Goal commands belong to the provider that owns the goal, not a model picked in the draft. + // Goal commands belong to the thread itself, not the model or modes picked in the draft. const modelSelection = thread.modelSelection; const serverConfig = selectedEnvironmentRuntime?.serverConfig; if ( @@ -858,11 +856,8 @@ export function useThreadComposerState(input: { text, attachments: [], modelSelection, - runtimeMode: draft.runtimeMode ?? thread.runtimeMode, - interactionMode: resolveProviderInteractionMode( - provider, - draft.interactionMode ?? thread.interactionMode, - ), + runtimeMode: thread.runtimeMode, + interactionMode: resolveProviderInteractionMode(provider, thread.interactionMode), createdAt: metadata.createdAt, }); return messageId; From 2a985afa248661d589c245af8f246797f9ee8d1d Mon Sep 17 00:00:00 2001 From: ravdeep kainth Date: Mon, 9 Nov 2026 12:10:16 +1100 Subject: [PATCH 7/9] fix(mobile): goal commands use the default interaction mode after the plan-mode removal --- apps/mobile/src/state/use-thread-composer-state.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts index cc6e27839e6c..1b8e3c681641 100644 --- a/apps/mobile/src/state/use-thread-composer-state.ts +++ b/apps/mobile/src/state/use-thread-composer-state.ts @@ -843,9 +843,6 @@ export function useThreadComposerState(input: { Dialog.alert(title, detail); return null; } - const provider = serverConfig?.providers.find( - (entry) => entry.instanceId === modelSelection.instanceId, - ); const metadata = makeQueuedMessageMetadata(); const messageId = MessageId.make(metadata.messageId); await enqueueThreadOutboxMessage({ @@ -857,7 +854,7 @@ export function useThreadComposerState(input: { attachments: [], modelSelection, runtimeMode: thread.runtimeMode, - interactionMode: resolveProviderInteractionMode(provider, thread.interactionMode), + interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE, createdAt: metadata.createdAt, }); return messageId; From 53be7fd773e6e1b522afb6e29c387b9fbf6fe29f Mon Sep 17 00:00:00 2001 From: maria-rcks Date: Wed, 18 Nov 2026 09:10:17 +0000 Subject: [PATCH 8/9] fix(mobile): preserve drafts when goal commands are rejected --- .../features/threads/ThreadDetailScreen.tsx | 9 ++++--- .../threads/floating-working-control.tsx | 7 +----- apps/mobile/src/i18n/translations/de.json | 4 ++++ apps/mobile/src/i18n/translations/en.json | 4 ++++ apps/mobile/src/i18n/translations/es.json | 4 ++++ apps/mobile/src/i18n/translations/fr.json | 4 ++++ apps/mobile/src/i18n/translations/ja.json | 4 ++++ apps/mobile/src/i18n/translations/ko.json | 4 ++++ apps/mobile/src/i18n/translations/pt-BR.json | 4 ++++ apps/mobile/src/i18n/translations/ru.json | 4 ++++ apps/mobile/src/i18n/translations/sv.json | 4 ++++ apps/mobile/src/i18n/translations/zh.json | 4 ++++ apps/mobile/src/state/thread-outbox-model.ts | 2 ++ .../src/state/thread-task-permissions.test.ts | 1 + .../src/state/threadOutboxDelivery.test.ts | 24 +++++++++++++++++++ apps/mobile/src/state/threadOutboxDelivery.ts | 8 +++++++ .../src/state/use-thread-composer-state.ts | 1 + 17 files changed, 83 insertions(+), 9 deletions(-) diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 6d316a3add30..31809d1ae9c3 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -721,7 +721,10 @@ function ThreadDetailBody( try { await props.onSendCommand(command); } catch (error) { - Dialog.alert("Could not update goal", error instanceof Error ? error.message : "Try again."); + Dialog.alert( + gt("Could not update goal"), + error instanceof Error ? error.message : gt("Try again."), + ); } setGoalCommandPending(false); }; @@ -895,8 +898,8 @@ function ThreadDetailBody( label: goal.title, accessibilityLabel: `${goal.title}: ${goal.objective}`, actions: [ - ...(canResumeGoal ? [goalAction("Resume", "Resume goal", "/goal resume")] : []), - goalAction("Clear", "Clear goal", "/goal clear"), + ...(canResumeGoal ? [goalAction(gt("Resume"), gt("Resume goal"), "/goal resume")] : []), + goalAction(gt("Clear"), gt("Clear goal"), "/goal clear"), ], }; } diff --git a/apps/mobile/src/features/threads/floating-working-control.tsx b/apps/mobile/src/features/threads/floating-working-control.tsx index 410b3731a9c9..993d7999baf8 100644 --- a/apps/mobile/src/features/threads/floating-working-control.tsx +++ b/apps/mobile/src/features/threads/floating-working-control.tsx @@ -2,12 +2,7 @@ import type { SubagentPillSegment } from "@t3tools/client-runtime/state/thread-s import { GlassContainer, GlassView } from "expo-glass-effect"; import { useGT } from "gt-react-native"; import { Fragment, type ReactNode, useEffect, useRef, useState } from "react"; -import { - type LayoutChangeEvent, - Pressable, - useWindowDimensions, - View, -} from "react-native"; +import { type LayoutChangeEvent, Pressable, useWindowDimensions, View } from "react-native"; import Animated, { Easing, FadeIn, diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index c9d43d96b3eb..e9a9a564a475 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -4303,6 +4303,7 @@ "f360accf1ccac178": "Runde gestoppt; der Agentenprozess läuft weiter", "967f83de030790dd": "{count, plural, =0 {Er wird mit anderen arbeitenden Threads geteilt. Stoppe diese, um ihn freizugeben.} one {Er wird mit {count} arbeitenden Thread geteilt. Stoppe diesen, um ihn freizugeben.} other {Er wird mit {count} arbeitenden Threads geteilt. Stoppe diese, um ihn freizugeben.}}", "5536ab75119ee3f9": "Thread konnte nicht aktualisiert werden", + "04c7bba52daa6f53": "Ziel konnte nicht aktualisiert werden", "f5f145b33e2a9380": "Wird gestoppt...", "e734a8e4a58a3835": "Stoppen", "0ce0ab7586e91607": "Hintergrundarbeit stoppen", @@ -4325,6 +4326,9 @@ "a20b495b9e6f82b9": "Wird gestartet…", "7917e738e8c3fd41": "Genehmigungsanfrage von {title} öffnen", "54c8b8a3c6e6046b": "Frage von {title} öffnen", + "715be2d41b9f1b72": "Ziel fortsetzen", + "5d0c71caa8f328b0": "Löschen", + "efe8657d62633cd4": "Ziel löschen", "cebceafe7ddc7d5d": "Feedback zur Genehmigung", "0830bd81f19bb753": "Sende Feedback zur Genehmigung ohne Anhänge oder zusätzlichen Kontext.", "d15878f290283f53": "Nachricht konnte nicht bearbeitet werden", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 7a89a1cf37c2..becabee9344e 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -4304,6 +4304,7 @@ "f360accf1ccac178": "Turn stopped; the agent process kept running", "967f83de030790dd": "{count, plural, =0 {It is shared with other working threads. Stop those to free it.} one {It is shared with {count} working thread. Stop those to free it.} other {It is shared with {count} working threads. Stop those to free it.}}", "5536ab75119ee3f9": "Could not update thread", + "04c7bba52daa6f53": "Could not update goal", "f5f145b33e2a9380": "Stopping...", "e734a8e4a58a3835": "Stop", "0ce0ab7586e91607": "Stop background work", @@ -4326,6 +4327,9 @@ "a20b495b9e6f82b9": "Starting…", "7917e738e8c3fd41": "Open approval from {title}", "54c8b8a3c6e6046b": "Open question from {title}", + "715be2d41b9f1b72": "Resume goal", + "5d0c71caa8f328b0": "Clear", + "efe8657d62633cd4": "Clear goal", "cebceafe7ddc7d5d": "Approval feedback", "0830bd81f19bb753": "Send approval feedback without attachments or added context.", "d15878f290283f53": "Could not edit message", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 288dbfc7da2c..45c90b584f40 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -4296,6 +4296,7 @@ "f360accf1ccac178": "Turno detenido; el proceso del agente siguió ejecutándose", "967f83de030790dd": "{count, plural, =0 {Se comparte con otros hilos en curso. Detenlos para liberarlo.} one {Se comparte con {count} hilo en curso. Detenlo para liberarlo.} other {Se comparte con {count} hilos en curso. Detenlos para liberarlo.}}", "5536ab75119ee3f9": "No se pudo actualizar el hilo", + "04c7bba52daa6f53": "No se pudo actualizar el objetivo", "f5f145b33e2a9380": "Deteniendo...", "e734a8e4a58a3835": "Detener", "0ce0ab7586e91607": "Detener el trabajo en segundo plano", @@ -4318,6 +4319,9 @@ "a20b495b9e6f82b9": "Iniciando…", "7917e738e8c3fd41": "Abrir la aprobación de {title}", "54c8b8a3c6e6046b": "Abrir la pregunta de {title}", + "715be2d41b9f1b72": "Reanudar objetivo", + "5d0c71caa8f328b0": "Borrar", + "efe8657d62633cd4": "Borrar objetivo", "cebceafe7ddc7d5d": "Comentarios de la aprobación", "0830bd81f19bb753": "Envía los comentarios de aprobación sin adjuntos ni contexto añadido.", "d15878f290283f53": "No se pudo editar el mensaje", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 28ec2284fca7..4e95661dd0e5 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -4297,6 +4297,7 @@ "f360accf1ccac178": "Tour arrêté ; le processus de l’agent continue de tourner", "967f83de030790dd": "{count, plural, =0 {Il est partagé avec d’autres fils en cours. Arrêtez-les pour le libérer.} one {Il est partagé avec {count} fil en cours. Arrêtez-le pour le libérer.} other {Il est partagé avec {count} fils en cours. Arrêtez-les pour le libérer.}}", "5536ab75119ee3f9": "Impossible de mettre à jour le fil", + "04c7bba52daa6f53": "Impossible de mettre à jour l’objectif", "f5f145b33e2a9380": "Arrêt...", "e734a8e4a58a3835": "Arrêter", "0ce0ab7586e91607": "Arrêter le travail en arrière-plan", @@ -4319,6 +4320,9 @@ "a20b495b9e6f82b9": "Démarrage…", "7917e738e8c3fd41": "Ouvrir l’approbation de {title}", "54c8b8a3c6e6046b": "Ouvrir la question de {title}", + "715be2d41b9f1b72": "Reprendre l’objectif", + "5d0c71caa8f328b0": "Effacer", + "efe8657d62633cd4": "Effacer l’objectif", "cebceafe7ddc7d5d": "Retour sur l’approbation", "0830bd81f19bb753": "Envoyez votre réponse à l’approbation sans pièces jointes ni contexte ajouté.", "d15878f290283f53": "Impossible de modifier le message", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index f6741fdb8b77..06ce3b9ad13d 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -4278,6 +4278,7 @@ "f360accf1ccac178": "ターンは停止しましたが、エージェントのプロセスは実行されたままです", "967f83de030790dd": "{count, plural, =0 {作業中の他のスレッドと共有されています。解放するにはそれらを停止してください。} other {作業中の {count} 個のスレッドと共有されています。解放するにはそれらを停止してください。}}", "5536ab75119ee3f9": "スレッドを更新できませんでした", + "04c7bba52daa6f53": "目標を更新できませんでした", "f5f145b33e2a9380": "停止しています...", "e734a8e4a58a3835": "停止", "0ce0ab7586e91607": "バックグラウンドの作業を停止", @@ -4300,6 +4301,9 @@ "a20b495b9e6f82b9": "開始しています…", "7917e738e8c3fd41": "{title} からの承認を開く", "54c8b8a3c6e6046b": "{title} からの質問を開く", + "715be2d41b9f1b72": "目標を再開", + "5d0c71caa8f328b0": "クリア", + "efe8657d62633cd4": "目標をクリア", "cebceafe7ddc7d5d": "承認へのフィードバック", "0830bd81f19bb753": "承認のフィードバックは、添付ファイルや追加のコンテキストなしで送信してください。", "d15878f290283f53": "メッセージを編集できませんでした", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index b1ef20ba0f34..14610753581c 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -4283,6 +4283,7 @@ "f360accf1ccac178": "턴이 중지되었지만 에이전트 프로세스가 계속 실행 중입니다", "967f83de030790dd": "{count, plural, =0 {다른 작업 중인 스레드와 공유되어 있습니다. 해제하려면 해당 스레드를 중지하세요.} other {작업 중인 스레드 {count}개와 공유되어 있습니다. 해제하려면 해당 스레드를 중지하세요.}}", "5536ab75119ee3f9": "스레드를 업데이트할 수 없습니다", + "04c7bba52daa6f53": "목표를 업데이트하지 못했습니다", "f5f145b33e2a9380": "중지하는 중...", "e734a8e4a58a3835": "중지", "0ce0ab7586e91607": "백그라운드 작업 중지", @@ -4305,6 +4306,9 @@ "a20b495b9e6f82b9": "시작하는 중…", "7917e738e8c3fd41": "{title}의 승인 요청 열기", "54c8b8a3c6e6046b": "{title}의 질문 열기", + "715be2d41b9f1b72": "목표 재개", + "5d0c71caa8f328b0": "지우기", + "efe8657d62633cd4": "목표 지우기", "cebceafe7ddc7d5d": "승인 피드백", "0830bd81f19bb753": "첨부 파일이나 추가 컨텍스트 없이 승인 피드백을 보내세요.", "d15878f290283f53": "메시지를 편집할 수 없습니다", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index b40494fca388..340b9d2c6f0f 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -4297,6 +4297,7 @@ "f360accf1ccac178": "Turno parado; o processo do agente continuou em execução", "967f83de030790dd": "{count, plural, =0 {Ele é compartilhado com outras threads em andamento. Pare-as para liberá-lo.} one {Ele é compartilhado com {count} thread em andamento. Pare-a para liberá-lo.} other {Ele é compartilhado com {count} threads em andamento. Pare-as para liberá-lo.}}", "5536ab75119ee3f9": "Não foi possível atualizar a thread", + "04c7bba52daa6f53": "Não foi possível atualizar o objetivo", "f5f145b33e2a9380": "Parando...", "e734a8e4a58a3835": "Parar", "0ce0ab7586e91607": "Parar trabalho em segundo plano", @@ -4319,6 +4320,9 @@ "a20b495b9e6f82b9": "Iniciando…", "7917e738e8c3fd41": "Abrir aprovação de {title}", "54c8b8a3c6e6046b": "Abrir pergunta de {title}", + "715be2d41b9f1b72": "Retomar objetivo", + "5d0c71caa8f328b0": "Limpar", + "efe8657d62633cd4": "Limpar objetivo", "cebceafe7ddc7d5d": "Feedback da aprovação", "0830bd81f19bb753": "Envie o feedback da aprovação sem anexos nem contexto adicional.", "d15878f290283f53": "Não foi possível editar a mensagem", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index cadf07e57eda..698c00d75d63 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -4375,6 +4375,7 @@ "f360accf1ccac178": "Ход остановлен; процесс агента продолжает работать", "967f83de030790dd": "{count, plural, =0 {Он используется другими работающими тредами. Остановите их, чтобы освободить его.} one {Он используется {count} работающим тредом. Остановите его, чтобы освободить.} few {Он используется {count} работающими тредами. Остановите их, чтобы освободить его.} many {Он используется {count} работающими тредами. Остановите их, чтобы освободить его.} other {Он используется {count} работающего треда. Остановите их, чтобы освободить его.}}", "5536ab75119ee3f9": "Не удалось обновить тред", + "04c7bba52daa6f53": "Не удалось обновить цель", "f5f145b33e2a9380": "Остановка...", "e734a8e4a58a3835": "Остановить", "0ce0ab7586e91607": "Остановить фоновую работу", @@ -4397,6 +4398,9 @@ "a20b495b9e6f82b9": "Запуск…", "7917e738e8c3fd41": "Открыть запрос подтверждения из {title}", "54c8b8a3c6e6046b": "Открыть вопрос из {title}", + "715be2d41b9f1b72": "Возобновить цель", + "5d0c71caa8f328b0": "Очистить", + "efe8657d62633cd4": "Очистить цель", "cebceafe7ddc7d5d": "Отзыв на подтверждение", "0830bd81f19bb753": "Отправьте отзыв на подтверждение без вложений и добавленного контекста.", "d15878f290283f53": "Не удалось изменить сообщение", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 3a0273aef36f..82f86f034c8d 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -4303,6 +4303,7 @@ "f360accf1ccac178": "Omgången stoppades; agentprocessen fortsatte att köras", "967f83de030790dd": "{count, plural, =0 {Den delas med andra arbetande trådar. Stoppa dem för att frigöra den.} one {Den delas med {count} arbetande tråd. Stoppa den för att frigöra den.} other {Den delas med {count} arbetande trådar. Stoppa dem för att frigöra den.}}", "5536ab75119ee3f9": "Kunde inte uppdatera tråden", + "04c7bba52daa6f53": "Kunde inte uppdatera målet", "f5f145b33e2a9380": "Stoppar...", "e734a8e4a58a3835": "Stoppa", "0ce0ab7586e91607": "Stoppa bakgrundsarbete", @@ -4325,6 +4326,9 @@ "a20b495b9e6f82b9": "Startar…", "7917e738e8c3fd41": "Öppna godkännande från {title}", "54c8b8a3c6e6046b": "Öppna fråga från {title}", + "715be2d41b9f1b72": "Återuppta målet", + "5d0c71caa8f328b0": "Rensa", + "efe8657d62633cd4": "Rensa målet", "cebceafe7ddc7d5d": "Feedback på godkännande", "0830bd81f19bb753": "Skicka feedback om godkännandet utan bilagor eller tillagd kontext.", "d15878f290283f53": "Kunde inte redigera meddelandet", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index f1c394c60c60..1e70f14da383 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -4286,6 +4286,7 @@ "f360accf1ccac178": "这一轮已停止,但智能体进程仍在运行", "967f83de030790dd": "{count, plural, =0 {它被其他正在工作的会话共用。停止那些会话即可释放。} other {它被 {count} 个正在工作的会话共用。停止那些会话即可释放。}}", "5536ab75119ee3f9": "无法更新会话", + "04c7bba52daa6f53": "无法更新目标", "f5f145b33e2a9380": "正在停止…", "e734a8e4a58a3835": "停止", "0ce0ab7586e91607": "停止后台工作", @@ -4308,6 +4309,9 @@ "a20b495b9e6f82b9": "正在启动…", "7917e738e8c3fd41": "打开来自 {title} 的批准请求", "54c8b8a3c6e6046b": "打开来自 {title} 的问题", + "715be2d41b9f1b72": "继续目标", + "5d0c71caa8f328b0": "清除", + "efe8657d62633cd4": "清除目标", "cebceafe7ddc7d5d": "批准反馈", "0830bd81f19bb753": "发送审批反馈时请不要带附件或额外上下文。", "d15878f290283f53": "无法编辑消息", diff --git a/apps/mobile/src/state/thread-outbox-model.ts b/apps/mobile/src/state/thread-outbox-model.ts index 2ab60eec8c2d..e0305b547d01 100644 --- a/apps/mobile/src/state/thread-outbox-model.ts +++ b/apps/mobile/src/state/thread-outbox-model.ts @@ -56,6 +56,7 @@ export const QueuedThreadMessageSchema = Schema.Struct({ messageId: MessageId, commandId: CommandId, text: Schema.String, + restoreToDraft: Schema.optional(Schema.Boolean), context: Schema.optional(OrchestrationMessageContext), attachments: Schema.Array(DraftComposerAttachmentSchema), modelSelection: Schema.optional(ModelSelection), @@ -88,6 +89,7 @@ export interface QueuedThreadMessage { readonly messageId: MessageId; readonly commandId: CommandId; readonly text: string; + readonly restoreToDraft?: boolean; readonly context?: OrchestrationMessageContext; readonly attachments: ReadonlyArray; readonly modelSelection?: ModelSelectionType; diff --git a/apps/mobile/src/state/thread-task-permissions.test.ts b/apps/mobile/src/state/thread-task-permissions.test.ts index df2274c42066..9c59af43cfa2 100644 --- a/apps/mobile/src/state/thread-task-permissions.test.ts +++ b/apps/mobile/src/state/thread-task-permissions.test.ts @@ -489,6 +489,7 @@ describe("mobile task permissions", () => { environmentId: "secondary", threadId: "thread", text: "/goal clear", + restoreToDraft: false, attachments: [], modelSelection: state.thread.modelSelection, }), diff --git a/apps/mobile/src/state/threadOutboxDelivery.test.ts b/apps/mobile/src/state/threadOutboxDelivery.test.ts index e77ce11e2c72..51691aca707e 100644 --- a/apps/mobile/src/state/threadOutboxDelivery.test.ts +++ b/apps/mobile/src/state/threadOutboxDelivery.test.ts @@ -939,6 +939,30 @@ describe("thread outbox recovery rollback", () => { }), ); + it.effect("keeps the draft unchanged when a standalone goal command is rejected", () => + Effect.gen(function* () { + const message: QueuedThreadMessage = { + ...queuedMessage({ messageId: "goal-rejected", text: "/goal clear" }), + restoreToDraft: false, + modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.6-sol" }, + runtimeMode: "full-access", + }; + const threadKey = `${message.environmentId}:${message.threadId}`; + appAtomRegistry.set(composerDrafts.composerDraftsAtom, { + [threadKey]: { text: "Keep my draft", attachments: [], runtimeMode: "approval-required" }, + }); + const draft = composerDrafts.getComposerDraftSnapshot(threadKey); + yield* Effect.promise(() => harness.manager.enqueue(message)); + expect(yield* restoreRejectedQueuedMessage(message, "rejected")).toBe("restored"); + expect(composerDrafts.getComposerDraftSnapshot(threadKey)).toEqual(draft); + expect(remainingMessages()).toEqual([]); + expect(appAtomRegistry.get(threadComposerErrorsAtom)[threadKey]).toEqual({ + message: "rejected", + messageId: message.messageId, + }); + }), + ); + it.effect("does not record a creation outcome for a rejected follow-up message", () => Effect.gen(function* () { const message = queuedMessage({ messageId: "message-followup-restore", text: "follow up" }); diff --git a/apps/mobile/src/state/threadOutboxDelivery.ts b/apps/mobile/src/state/threadOutboxDelivery.ts index d9e56da0d922..df0761906402 100644 --- a/apps/mobile/src/state/threadOutboxDelivery.ts +++ b/apps/mobile/src/state/threadOutboxDelivery.ts @@ -478,6 +478,14 @@ export const restoreRejectedQueuedMessage = Effect.fn("ThreadOutbox.restoreRejec return "deferred" as const; } const revision = threadOutboxRevision(queuedMessage.messageId); + if (queuedMessage.restoreToDraft === false) { + const removed = yield* storage("remove-rejected-command", queuedMessage.messageId, () => + removeThreadOutboxMessage(queuedMessage, revision, () => !editing()), + ); + if (!removed) return "deferred" as const; + setThreadComposerError(threadKey, message, queuedMessage.messageId); + return "restored" as const; + } yield* storage("load-drafts", queuedMessage.messageId, () => waitForComposerDraftsLoaded()); if (editing()) return "deferred" as const; const originalDraft = getComposerDraftSnapshot(draftKey); diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts index 7eb74003d9ea..b2a5d4e4bfab 100644 --- a/apps/mobile/src/state/use-thread-composer-state.ts +++ b/apps/mobile/src/state/use-thread-composer-state.ts @@ -965,6 +965,7 @@ export function useThreadComposerState(input: { messageId, commandId: CommandId.make(metadata.commandId), text, + restoreToDraft: false, attachments: [], modelSelection, runtimeMode: thread.runtimeMode, From 301a7fdfb85bba1b171988e809adcd10054a6fdf Mon Sep 17 00:00:00 2001 From: maria-rcks Date: Wed, 18 Nov 2026 09:11:23 +0000 Subject: [PATCH 9/9] fix(mobile): reuse the unsendable outbox storage operation --- apps/mobile/src/state/threadOutboxDelivery.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mobile/src/state/threadOutboxDelivery.ts b/apps/mobile/src/state/threadOutboxDelivery.ts index df0761906402..53692212126b 100644 --- a/apps/mobile/src/state/threadOutboxDelivery.ts +++ b/apps/mobile/src/state/threadOutboxDelivery.ts @@ -479,7 +479,7 @@ export const restoreRejectedQueuedMessage = Effect.fn("ThreadOutbox.restoreRejec } const revision = threadOutboxRevision(queuedMessage.messageId); if (queuedMessage.restoreToDraft === false) { - const removed = yield* storage("remove-rejected-command", queuedMessage.messageId, () => + const removed = yield* storage("remove-unsendable", queuedMessage.messageId, () => removeThreadOutboxMessage(queuedMessage, revision, () => !editing()), ); if (!removed) return "deferred" as const;