feat(KB-150): kill active agent sessions on global pause

- Add settings:updated event to TaskStore with previous/new settings payload
- Kill all active executor agent sessions when globalPause transitions false→true
- Kill all active triage specification sessions on global pause with clean status reset
- Track and dispose active merger session on global pause via onSession callback
- Add JSDoc documenting global pause behavior on executor and triage constructors
This commit is contained in:
Dustin Byrne
2026-03-28 02:16:30 -04:00
parent 72a8953e4e
commit d32c9c031f
9 changed files with 443 additions and 5 deletions

View File

@@ -107,6 +107,10 @@ export interface MergerOptions {
pool?: WorktreePool;
/** Usage limit pauser — triggers global pause when API limits are detected. */
usageLimitPauser?: UsageLimitPauser;
/** Called with the agent session immediately after creation. Enables the
* caller (e.g. dashboard.ts) to track and externally dispose the session
* when a global pause is triggered. */
onSession?: (session: { dispose: () => void }) => void;
}
/**
@@ -248,6 +252,9 @@ export async function aiMergeTask(
defaultThinkingLevel: settings.defaultThinkingLevel,
});
// Notify the caller so it can track/dispose the session externally (e.g. on global pause)
options.onSession?.(session);
try {
const prompt = buildMergePrompt(taskId, branch, commitLog, diffStat, hasConflicts);
await session.prompt(prompt);