feat(HAI-040): count specifying tasks toward maxConcurrent
- Count triage tasks with status 'specifying' as active agent slots in scheduler - Rewrite scheduler tests to focus on concurrency slot accounting - Add tests for specifying-only, mixed, and no-specifying scenarios - Use direct schedule() invocation pattern to avoid timer complexity in tests
This commit is contained in:
@@ -137,6 +137,14 @@ export class Scheduler {
|
||||
|
||||
const inProgress = tasks.filter((t) => t.column === "in-progress");
|
||||
|
||||
// Specifying tasks (triage column, status "specifying") run full PI
|
||||
// agent sessions that consume the same resources as execution agents,
|
||||
// so they must occupy concurrency slots alongside in-progress tasks.
|
||||
const specifying = tasks.filter(
|
||||
(t) => t.column === "triage" && t.status === "specifying",
|
||||
);
|
||||
const agentSlots = inProgress.length + specifying.length;
|
||||
|
||||
// When a semaphore is provided, factor in its available slots so we
|
||||
// don't schedule more tasks than the global limit allows. Triage and
|
||||
// merge agents also hold semaphore slots, so availableCount may be
|
||||
@@ -146,7 +154,7 @@ export class Scheduler {
|
||||
: Infinity;
|
||||
|
||||
const available = Math.min(
|
||||
maxConcurrent - inProgress.length,
|
||||
maxConcurrent - agentSlots,
|
||||
maxWorktrees - activeWorktrees,
|
||||
semaphoreAvailable,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user