diff --git a/apps/desktop/src-tauri/src/claude_process.rs b/apps/desktop/src-tauri/src/claude_process.rs index d9df78a..b8cf90e 100644 --- a/apps/desktop/src-tauri/src/claude_process.rs +++ b/apps/desktop/src-tauri/src/claude_process.rs @@ -320,11 +320,13 @@ async fn interrupt_or_terminate(child: &mut Child) -> bool { } #[cfg(not(unix))] -async fn interrupt_or_terminate(_child: &mut Child) -> bool { +async fn interrupt_or_terminate(child: &mut Child) -> bool { // Windows GUI processes do not have a reliable console-control path from - // Tauri without a PTY/ConPTY session. Keep this fallback isolated so the - // future long-lived session driver can replace it cleanly. - false + // Tauri without a PTY/ConPTY session. For guided follow-ups, fall back to + // terminating the current run so the frontend can immediately continue the + // same tab with the queued guidance. + let _ = child.start_kill(); + true } /// Kill all Claude processes associated with a specific window label. diff --git a/apps/desktop/src/hooks/use-claude-events.ts b/apps/desktop/src/hooks/use-claude-events.ts index 21b5b3d..25a5853 100644 --- a/apps/desktop/src/hooks/use-claude-events.ts +++ b/apps/desktop/src/hooks/use-claude-events.ts @@ -389,6 +389,23 @@ export function useClaudeEvents() { const completedSessionId = tab.sessionId; chatStore._setStreaming(tabId, false); + const forceQueuedGuidance = tab.forceQueuedGuidanceOnComplete === true; + if (forceQueuedGuidance) { + const queuedGuidance = useClaudeChatStore + .getState() + .consumeQueuedGuidance(tabId, tab.forcedQueuedGuidanceId); + if (queuedGuidance) { + log.info(`[${tabId}] interrupting current run with queued guidance`); + void useClaudeChatStore + .getState() + .sendPrompt(queuedGuidance.prompt, queuedGuidance.contextOverride, { + tabId, + preserveTabProvider: true, + }); + return; + } + } + // Snapshot after Claude edit const projectPath = useDocumentStore.getState().projectRoot; if (projectPath && completedSessionId) { @@ -427,16 +444,9 @@ export function useClaudeEvents() { const docStore = useDocumentStore.getState(); await docStore.refreshFiles(); - const forceQueuedGuidance = tab.forceQueuedGuidanceOnComplete === true; - const queuedGuidance = - success || forceQueuedGuidance - ? useClaudeChatStore - .getState() - .consumeQueuedGuidance( - tabId, - forceQueuedGuidance ? tab.forcedQueuedGuidanceId : null, - ) - : null; + const queuedGuidance = success + ? useClaudeChatStore.getState().consumeQueuedGuidance(tabId) + : null; if (queuedGuidance) { log.info(`[${tabId}] continuing with queued guidance`); void useClaudeChatStore