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:
Mohamed Boudra
2026-03-25 17:22:46 +07:00
parent 6b67e6569b
commit 4c1b11f733
@@ -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");
});