fix(engine): respect global pause in reviewer + stuck detector

Reviewer subprocesses were spawned via fn_review_spec / fn_review_step
even with globalPause on, because reviewer.ts had no pause awareness.
Stuck detector also kept running, treating pause-disposed sessions as
inactivity and re-queuing tasks. Pause-transition listeners only called
session.dispose(), which doesn't always interrupt an in-flight LLM
stream — letting reviewer spawns leak through after pause flipped.

- reviewer.ts: re-read settings, return UNAVAILABLE without spawning
  when globalPause/enginePaused is on.
- stuck-task-detector.ts: skip checkStuckTasks() while paused.
- triage.ts / executor.ts: call session.abort() before dispose() in the
  pause-transition listener to interrupt in-flight work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-27 17:26:01 -07:00
parent e598d60f01
commit 53e763e35f
4 changed files with 55 additions and 0 deletions

View File

@@ -494,6 +494,14 @@ export class TriageProcessor {
);
this.pauseAborted.add(taskId);
this.options.stuckTaskDetector?.untrackTask(taskId);
// abort() interrupts any in-flight LLM stream / tool call;
// dispose() then releases session resources.
const sessionWithAbort = session as { abort?: () => Promise<void>; dispose: () => void };
if (typeof sessionWithAbort.abort === "function") {
void sessionWithAbort.abort().catch((err) => {
planLog.warn(`Failed to abort triage session for ${taskId}: ${err}`);
});
}
session.dispose();
}
}