Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(mobile): steer active turns by default (#6543)
Chris Deeming184d8ef33b8f
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsxindex 60944ec1c..55a4eed56 100644--- a/apps/mobile/src/features/threads/ThreadComposer.tsx+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx@@ -105,7 +105,6 @@ export interface ThreadComposerProps {readonly selectedThread: OrchestrationThreadShell;readonly serverConfig: T3ServerConfig | null;readonly queueCount: number;- readonly activeThreadBusy: boolean;readonly environmentId: EnvironmentId;readonly projectCwd: string | null;readonly editorRef?: RefObject<ComposerEditorHandle | null>;@@ -327,9 +326,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerprops.selectedThread.session?.status === "starting";const sendLabel =- props.connectionState !== "connected" || props.activeThreadBusy || props.queueCount > 0- ? "Queue"- : "Send";+ props.connectionState !== "connected" || props.queueCount > 0 ? "Queue" : "Send";const currentModelSelection = props.selectedThread.modelSelection;const currentRuntimeMode = props.selectedThread.runtimeMode;const connectionStatus = composerConnectionStatus({diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsxindex 978fc4464..fb859090a 100644--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx@@ -101,7 +101,6 @@ export interface ThreadDetailScreenProps {readonly threadSyncStatus?: EnvironmentThreadStatus;/** Non-null when older turns exist beyond the loaded window. */readonly loadEarlier?: { readonly loading: boolean; readonly onLoadEarlier: () => void } | null;- readonly activeThreadBusy: boolean;readonly environmentId: EnvironmentId;readonly projectWorkspaceRoot: string | null;readonly threadCwd: string | null;@@ -727,7 +726,6 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadselectedThread={props.selectedThread}serverConfig={props.serverConfig}queueCount={props.selectedThreadQueueCount}- activeThreadBusy={props.activeThreadBusy}environmentId={props.environmentId}projectCwd={props.projectWorkspaceRoot}bottomInset={composerBottomInset}diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsxindex d7754b7d7..cad1cab8e 100644--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx@@ -785,7 +785,6 @@ function ThreadRouteContent(connectionStateLabel={routeConnectionState}threadSyncStatus={selectedThreadDetailState.status}loadEarlier={loadEarlierTurns}- activeThreadBusy={composer.activeThreadBusy}environmentId={selectedThread.environmentId}projectWorkspaceRoot={selectedThreadProject?.workspaceRoot ?? null}threadCwd={selectedThreadCwd}diff --git a/apps/mobile/src/state/thread-outbox-model.ts b/apps/mobile/src/state/thread-outbox-model.tsindex 3ba61be38..eede50697 100644--- a/apps/mobile/src/state/thread-outbox-model.ts+++ b/apps/mobile/src/state/thread-outbox-model.ts@@ -169,7 +169,7 @@ export function resolveThreadOutboxDeliveryAction(input: {if (!input.threadExists) {return input.shellStatus === "live" ? "remove" : "wait";}- return input.environmentConnected && !input.threadBusy ? "send" : "wait";+ return input.environmentConnected ? "send" : "wait";}/**diff --git a/apps/mobile/src/state/thread-outbox.test.ts b/apps/mobile/src/state/thread-outbox.test.tsindex 89f8b2679..b12ad2dc5 100644--- a/apps/mobile/src/state/thread-outbox.test.ts+++ b/apps/mobile/src/state/thread-outbox.test.ts@@ -487,6 +487,27 @@ describe("thread outbox", () => {).toBe("send");});+ it("sends existing-thread messages whenever connected so queued messages can steer", () => {+ expect(+ resolveThreadOutboxDeliveryAction({+ isCreation: false,+ threadExists: true,+ shellStatus: "live",+ environmentConnected: true,+ threadBusy: true,+ }),+ ).toBe("send");+ expect(+ resolveThreadOutboxDeliveryAction({+ isCreation: false,+ threadExists: true,+ shellStatus: "live",+ environmentConnected: false,+ threadBusy: true,+ }),+ ).toBe("wait");+ });+it("sends queued creations once connected and live, removing already-created ones", () => {expect(resolveThreadOutboxDeliveryAction({diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.tsindex b09aadf7e..721c82a0e 100644--- a/apps/mobile/src/state/use-thread-composer-state.ts+++ b/apps/mobile/src/state/use-thread-composer-state.ts@@ -129,10 +129,6 @@ export function useThreadComposerState() {);}, [selectedThreadDetail, selectedThreadSessionActivity, selectedThreadShell]);- const activeThreadBusy =- !!selectedThread &&- (selectedThread.session?.status === "running" || selectedThread.session?.status === "starting");-const onSendMessage = useCallback(async () => {if (!selectedThreadShell) {return null;@@ -308,7 +304,6 @@ export function useThreadComposerState() {modelSelection,runtimeMode,interactionMode,- activeThreadBusy,onChangeDraftMessage,onPickDraftImages,onPasteIntoDraft,diff --git a/apps/mobile/src/state/use-thread-outbox-drain.ts b/apps/mobile/src/state/use-thread-outbox-drain.tsindex d06a4098a..68c973ff9 100644--- a/apps/mobile/src/state/use-thread-outbox-drain.ts+++ b/apps/mobile/src/state/use-thread-outbox-drain.ts@@ -37,7 +37,7 @@ import {type QueuedThreadMessage,type ThreadOutboxCommandStage,} from "./thread-outbox-model";-import { environmentThreadShells, threadEnvironment } from "./threads";+import { threadEnvironment } from "./threads";import { useAtomCommand } from "./use-atom-command";import {editingQueuedMessageIdsAtom,@@ -362,22 +362,12 @@ export function useThreadOutboxDrain(): void {return true;}// The guards evaluated before the confirmation await are stale by now:- // the thread may have gone busy, or the user may have opened this- // message in the editor. Re-read both and defer to the next drain pass- // (returning true skips the failure/backoff path) rather than sending- // a payload the user is editing or racing an active turn.+ // the user may have opened this message in the editor. Re-read that+ // guard and defer to the next drain pass (returning true skips the+ // failure/backoff path) rather than sending a payload being edited.if (appAtomRegistry.get(editingQueuedMessageIdsAtom)[nextQueuedMessage.messageId]) {return true;}- const freshThread = findThread(- appAtomRegistry.get(environmentThreadShells.threadShellsAtom),- nextQueuedMessage,- );- const freshThreadBusy =- freshThread?.session?.status === "running" || freshThread?.session?.status === "starting";- if (deliveryAction === "send" && creation === undefined && freshThreadBusy) {- return true;- }return deliveryAction === "remove"? removeQueuedMessage("[thread-outbox] failed to remove message for a missing thread"): creation !== undefined