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:
@@ -8,7 +8,7 @@ import { Type, type Static } from "@mariozechner/pi-ai";
|
||||
import { createKbAgent } from "./pi.js";
|
||||
import { reviewStep, type ReviewVerdict } from "./reviewer.js";
|
||||
import type { ToolDefinition, AgentSession, SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import type { AgentSemaphore } from "./concurrency.js";
|
||||
import { PRIORITY_EXECUTE, type AgentSemaphore } from "./concurrency.js";
|
||||
import type { WorktreePool } from "./worktree-pool.js";
|
||||
import { AgentLogger } from "./agent-logger.js";
|
||||
import { executorLog, reviewerLog } from "./logger.js";
|
||||
@@ -413,7 +413,7 @@ export class TaskExecutor {
|
||||
};
|
||||
|
||||
if (this.options.semaphore) {
|
||||
await this.options.semaphore.run(agentWork);
|
||||
await this.options.semaphore.run(agentWork, PRIORITY_EXECUTE);
|
||||
} else {
|
||||
await agentWork();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user