feat(KB-145): add global pause button to halt all AI engine activity

- Add globalPause setting to core Settings type with default false
- Guard scheduler, triage, and auto-merge queue to skip work when globalPause is active
- Add pause/play toggle button in dashboard Header with optimistic UI and rollback on failure
- Add tests for scheduler, triage, Header, and App global pause behavior
- Include minor changeset for the new feature
This commit is contained in:
Dustin Byrne
2026-03-28 01:01:05 -04:00
parent e0f33fb32c
commit 50821fc820
11 changed files with 399 additions and 8 deletions

View File

@@ -92,8 +92,12 @@ export async function runDashboard(port: number, opts: { open?: boolean } = {})
while (mergeQueue.length > 0) {
const taskId = mergeQueue.shift()!;
try {
// Re-check autoMerge before each merge (setting may have been toggled)
// Re-check autoMerge and globalPause before each merge (setting may have been toggled)
const settings = await store.getSettings();
if (settings.globalPause) {
console.log(`[auto-merge] Skipping ${taskId} — global pause active`);
continue;
}
if (!settings.autoMerge) {
console.log(`[auto-merge] Skipping ${taskId} — autoMerge disabled`);
continue;
@@ -128,6 +132,7 @@ export async function runDashboard(port: number, opts: { open?: boolean } = {})
if (task.paused) return;
try {
const settings = await store.getSettings();
if (settings.globalPause) return;
if (!settings.autoMerge) return;
enqueueMerge(task.id);
} catch { /* ignore settings read errors */ }
@@ -203,7 +208,7 @@ export async function runDashboard(port: number, opts: { open?: boolean } = {})
const s = await store.getSettings();
// Refresh the cached limit so the semaphore picks up live changes
cachedMaxConcurrent = s.maxConcurrent;
if (s.autoMerge) {
if (!s.globalPause && s.autoMerge) {
const tasks = await store.listTasks();
for (const t of tasks) {
if (t.column === "in-review" && !t.paused) {