fix(mobile): make Stop work during preparing worktree phase #12188
ClosedImBIOS(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/12188/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -26,4 +26,8 @@2626 import { useSafeAreaInsets } from "react-native-safe-area-context";2727 import { useWorkspaceState } from "../../state/workspace";2828 import { restoredNewTaskDraftKey } from "../../state/new-task-draft-key";29-import { clearPendingThreadCreationOutcome } from "../../state/pending-thread-creation";29+import {30+ clearPendingThreadCreationOutcome,31+ resolvePreparingStopAction,32+} from "../../state/pending-thread-creation";33+import { removeThreadOutboxMessage } from "../../state/thread-outbox-removal";@@ -308,4 +312,5 @@308312 const showStopAction =309313 !hasContent &&310314 (props.selectedThread.session?.status === "running" ||311- props.selectedThread.session?.status === "starting");315+ props.selectedThread.session?.status === "starting" ||316+ props.isPreparingCreation);
- @@ -308,4 +312,5 @@308312 const showStopAction =309313 !hasContent &&310314 (props.selectedThread.session?.status === "running" ||311- props.selectedThread.session?.status === "starting");315+ props.selectedThread.session?.status === "starting" ||316+ props.isPreparingCreation);@@ -506,0 +512,21 @@512+ ? "delivered"513+ : selectedThreadCreation?.outcome?.kind === "failed"514+ ? "failed"515+ : null,516+ creationMessageId: selectedThreadCreation517+ ? String(selectedThreadCreation.message.messageId)518+ : null,519+ dispatchingMessageId: composer.dispatchingQueuedMessageId520+ ? String(composer.dispatchingQueuedMessageId)521+ : null,522+ sessionStatus: selectedThread?.session?.status ?? null,523+ });524+ // A still-queued creation has no server turn to interrupt: cancel it525+ // locally with immediate feedback instead of a silent no-op (#12187).526+ if (stopAction.kind === "cancel-queued-creation" && selectedThreadCreation) {527+ const queuedMessage = selectedThreadCreation.message;528+ const threadKey = routeThreadIdentity;529+ setIsStoppingThread(true);530+ void (async () => {531+ try {532+ const removed = await removeThreadOutboxMessage(queuedMessage);@@ -506,0 +514,21 @@514+ ? "failed"515+ : null,516+ creationMessageId: selectedThreadCreation517+ ? String(selectedThreadCreation.message.messageId)518+ : null,519+ dispatchingMessageId: composer.dispatchingQueuedMessageId520+ ? String(composer.dispatchingQueuedMessageId)521+ : null,522+ sessionStatus: selectedThread?.session?.status ?? null,523+ });524+ // A still-queued creation has no server turn to interrupt: cancel it525+ // locally with immediate feedback instead of a silent no-op (#12187).526+ if (stopAction.kind === "cancel-queued-creation" && selectedThreadCreation) {527+ const queuedMessage = selectedThreadCreation.message;528+ const threadKey = routeThreadIdentity;529+ setIsStoppingThread(true);530+ void (async () => {531+ try {532+ const removed = await removeThreadOutboxMessage(queuedMessage);533+ if (!removed) {534+ return;@@ -209,12 +213,15 @@209213 // Codex/Grok experience where reasoning is always configurable). The set210214 // covers the common OpenCode variant spectrum; `inferDefaultVariant`211215 // picks the provider-appropriate default (e.g. medium for openai/opencode).212- const variantValues =213- rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"];216+ const variantValues = (217+ rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"]218+ ).map(sanitizeTerminalValue);214219 const defaultVariant = inferDefaultVariant(input.providerID, variantValues);215220 const variantOptions = variantValues.map((value) =>216221 defaultVariant === value217222 ? { id: value, label: titleCaseSlug(value), isDefault: true as const }218223 : { id: value, label: titleCaseSlug(value) },219224 );220- const primaryAgents = input.agents.filter(225+ const sanitizedAgents = input.agents.map((agent) => ({226+ ...agent,227+ name: sanitizeTerminalValue(agent.name),
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed