fix: close Pi subagent review gaps
This commit is contained in:
@@ -353,8 +353,12 @@ export class PiSubagentScheduler {
|
||||
let child: PiSubagentChild | undefined;
|
||||
try {
|
||||
releaseChild = await this.childPermits.acquire(record.controller.signal);
|
||||
await this.reclaimIdleCapacity(record.controller.signal);
|
||||
processLease = await this.processBudget.acquire(record.controller.signal);
|
||||
const budgetWasFull = this.processBudget.activeCount >= this.processBudget.maxProcesses;
|
||||
const processLeaseFlight = this.processBudget.acquire(record.controller.signal, 'child');
|
||||
if (budgetWasFull && this.reclaimProcessCapacity) {
|
||||
await this.reclaimProcessCapacity();
|
||||
}
|
||||
processLease = await processLeaseFlight;
|
||||
if (record.controller.signal.aborted) throw new PiSubagentChildError('SUBAGENT_ABORTED');
|
||||
projected.status = 'running';
|
||||
this.emit(details, onUpdate);
|
||||
@@ -391,14 +395,6 @@ export class PiSubagentScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
private async reclaimIdleCapacity(signal: AbortSignal): Promise<void> {
|
||||
while (!signal.aborted
|
||||
&& this.processBudget.activeCount >= this.processBudget.maxProcesses
|
||||
&& this.reclaimProcessCapacity) {
|
||||
if (!await this.reclaimProcessCapacity()) break;
|
||||
}
|
||||
}
|
||||
|
||||
private markRemaining(
|
||||
details: SubagentDetailsV1,
|
||||
from: number,
|
||||
|
||||
Reference in New Issue
Block a user