Revert incorrect Claude interrupt flags that broke autonomous wake
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.
This commit is contained in:
@@ -1325,7 +1325,6 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
const turnId = this.createTurnId("foreground");
|
const turnId = this.createTurnId("foreground");
|
||||||
this.activeForegroundTurnId = turnId;
|
this.activeForegroundTurnId = turnId;
|
||||||
this.foregroundHasVisibleActivity = false;
|
this.foregroundHasVisibleActivity = false;
|
||||||
this.pendingInterruptAbort = false;
|
|
||||||
this.transitionTurnState("foreground", "foreground turn started");
|
this.transitionTurnState("foreground", "foreground turn started");
|
||||||
this.clearRecentStderr();
|
this.clearRecentStderr();
|
||||||
|
|
||||||
@@ -1344,7 +1343,6 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
provider: "claude",
|
provider: "claude",
|
||||||
reason: "Interrupted",
|
reason: "Interrupted",
|
||||||
});
|
});
|
||||||
this.queryRestartNeeded = true;
|
|
||||||
void this.interruptActiveTurn().catch((error) => {
|
void this.interruptActiveTurn().catch((error) => {
|
||||||
this.logger.warn({ err: error }, "Failed to interrupt during cancel");
|
this.logger.warn({ err: error }, "Failed to interrupt during cancel");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user