From 4c1b11f73352eba38aec7b5102db3c6a2bf5c1b5 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 25 Mar 2026 17:22:46 +0700 Subject: [PATCH] Revert incorrect Claude interrupt flags that broke autonomous wake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove `pendingInterruptAbort = false` from startTurn() and `queryRestartNeeded = true` from requestCancel(). Both violated the existing coordination contracts: - pendingInterruptAbort must only be cleared by the stream pump at its safe consumption points, not eagerly by the turn lifecycle - queryRestartNeeded is for transport-level restarts (config changes, rewind), not for normal interrupt/cancel flows — setting it on every cancel killed the Claude process and destroyed background tasks The actual fix for the send-during-tool-call bug was the manager-side pendingForegroundRun settlement wait added in the previous commit. --- packages/server/src/server/agent/providers/claude-agent.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/server/src/server/agent/providers/claude-agent.ts b/packages/server/src/server/agent/providers/claude-agent.ts index c42e9a8ce..f6a8107b8 100644 --- a/packages/server/src/server/agent/providers/claude-agent.ts +++ b/packages/server/src/server/agent/providers/claude-agent.ts @@ -1325,7 +1325,6 @@ class ClaudeAgentSession implements AgentSession { const turnId = this.createTurnId("foreground"); this.activeForegroundTurnId = turnId; this.foregroundHasVisibleActivity = false; - this.pendingInterruptAbort = false; this.transitionTurnState("foreground", "foreground turn started"); this.clearRecentStderr(); @@ -1344,7 +1343,6 @@ class ClaudeAgentSession implements AgentSession { provider: "claude", reason: "Interrupted", }); - this.queryRestartNeeded = true; void this.interruptActiveTurn().catch((error) => { this.logger.warn({ err: error }, "Failed to interrupt during cancel"); });