Skip to content

Commit 1798b4d

Browse files
fix(web,mobile): a send after a stopped worktree setup shows as queued from the start
The server holds a message sent while the thread still waits for a worktree after failed or interrupted setup, but the clients only predicted that while setup was preparing or starting. They rendered the message as sent, then it flipped to queued once the server answered. Both clients now use the shared orchestrationV2WorktreePending check, so the send dispatches as a queue and renders queued immediately. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 341476c commit 1798b4d

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎apps/mobile/src/state/use-thread-composer-state.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,9 +770,16 @@ export function useThreadComposerState(input: {
770770
alternateModifier: followUpOverride !== undefined && followUpOverride !== activeTurnDefault,
771771
activeTurnDefault,
772772
});
773-
const setupRunning = [selectedThreadActivityRun?.status, selectedThreadRuntime?.status].some(
774-
(status) => status === "preparing" || status === "starting",
773+
// A stopped worktree setup still holds new sends on the server.
774+
const worktreePending = orchestrationV2WorktreePending(
775+
selectedThreadShell.worktreePath ?? null,
776+
selectedThreadProjection?.projection.runs ?? [],
775777
);
778+
const setupRunning =
779+
worktreePending ||
780+
[selectedThreadActivityRun?.status, selectedThreadRuntime?.status].some(
781+
(status) => status === "preparing" || status === "starting",
782+
);
776783
const followUpDispatchMode = setupRunning
777784
? "queue"
778785
: followUpAction === "auto"

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,8 +1479,15 @@ export default function ChatView(props: ChatViewProps) {
14791479
deriveActiveWorkStartedAt(activeActivityRun, activeRuntime, localDispatchStartedAt) ??
14801480
runlessWorkStartedAt;
14811481
const activeRunPreparing = activeActivityRun?.status === "preparing";
1482+
// A stopped worktree setup still holds new sends, so they queue rather than flash as sent.
14821483
const sendQueuesBehindSetup =
1483-
isServerThread && (activeRunPreparing || activeActivityRun?.status === "starting");
1484+
isServerThread &&
1485+
(activeRunPreparing ||
1486+
activeActivityRun?.status === "starting" ||
1487+
orchestrationV2WorktreePending(
1488+
activeThread?.worktreePath ?? null,
1489+
serverProjection?.runs ?? [],
1490+
));
14841491
const [setupQueueSendThreadKey, setSetupQueueSendThreadKey] = useState<string | null>(null);
14851492
const downloadFileAttachment = async (attachment: ChatFileAttachment) => {
14861493
const connection = readPreparedConnection(environmentId);

0 commit comments

Comments
 (0)