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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user