feat(KB-176): make enginePaused a soft pause that lets running agents finish

- Remove agent termination listeners for enginePaused in executor and triage
- Update Settings.enginePaused JSDoc to document soft-pause semantics
- Update executor/triage/integration tests to assert sessions are NOT disposed on enginePaused
- Remove pause-abort tracking for enginePaused (only globalPause hard-stops agents)
- Add changeset for the behavioral change
This commit is contained in:
Dustin Byrne
2026-03-28 16:47:23 -04:00
parent 6fdd83dcca
commit d2e2e50a15
7 changed files with 91 additions and 194 deletions

View File

@@ -172,7 +172,8 @@ export class TaskExecutor {
* Listens for `task:moved` to auto-execute tasks moved to `in-progress`,
* `task:updated` to terminate agent sessions when individual tasks are paused,
* and `settings:updated` to terminate **all** active agent sessions when
* `globalPause` or `enginePaused` transitions from `false` to `true`.
* `globalPause` transitions from `false` to `true`. `enginePaused` only
* prevents new work dispatch — running sessions continue to completion.
* Paused tasks are moved back to `todo` rather than marked as `failed`.
*/
constructor(
@@ -209,17 +210,6 @@ export class TaskExecutor {
}
});
// When enginePaused transitions from false → true, terminate all active agent sessions.
// Same pattern as globalPause: agents are killed, tasks moved to todo (not failed).
store.on("settings:updated", ({ settings, previous }) => {
if (settings.enginePaused && !previous.enginePaused) {
for (const [taskId, session] of this.activeSessions) {
executorLog.log(`Engine pause — terminating agent session for ${taskId}`);
this.pausedAborted.add(taskId);
session.dispose();
}
}
});
}
/**