feat(KB-138): add priority-based scheduling to AgentSemaphore
- Add priority levels (PRIORITY_MERGE=2, PRIORITY_EXECUTE=1, PRIORITY_SPECIFY=0) to AgentSemaphore - Update acquire() and run() to accept a numeric priority parameter with FIFO ordering within same level - Wire priority constants into executor (PRIORITY_EXECUTE) and triage (PRIORITY_SPECIFY) callers - Add comprehensive tests for priority ordering, FIFO within same priority, and dynamic limit interaction - Include changeset for the priority-based agent scheduling feature
This commit is contained in:
@@ -2,7 +2,7 @@ import { exec } from "node:child_process";
|
||||
import type { AddressInfo } from "node:net";
|
||||
import { TaskStore } from "@kb/core";
|
||||
import { createServer } from "@kb/dashboard";
|
||||
import { TriageProcessor, TaskExecutor, Scheduler, AgentSemaphore, WorktreePool, aiMergeTask } from "@kb/engine";
|
||||
import { TriageProcessor, TaskExecutor, Scheduler, AgentSemaphore, WorktreePool, aiMergeTask, PRIORITY_MERGE } from "@kb/engine";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
function openBrowser(url: string): void {
|
||||
@@ -57,7 +57,7 @@ export async function runDashboard(port: number, opts: { open?: boolean } = {})
|
||||
onAgentTool: (name) => console.log(`[merger] tool: ${name}`),
|
||||
});
|
||||
|
||||
const onMerge = (taskId: string) => semaphore.run(() => rawMerge(taskId));
|
||||
const onMerge = (taskId: string) => semaphore.run(() => rawMerge(taskId), PRIORITY_MERGE);
|
||||
|
||||
// ── Serialized auto-merge queue ─────────────────────────────────────
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user