fix(agent): released ollama-cloud semaphore slot when waiter aborts

Semaphore.acquire now accepts an AbortSignal so a queued waiter that is cancelled (parent task abort, wall-clock budget elapsing) removes itself from the wait queue instead of being resolved by the next release. The provider semaphore in runSubprocess passes the run's abortSignal through, preventing aborted ollama-cloud subagents from permanently draining the provider concurrency budget.

Fixes #3464
This commit is contained in:
roboomp
2026-06-25 12:14:45 +00:00
parent 80862b79da
commit 7e90e4d081
3 changed files with 59 additions and 5 deletions
+1 -2
View File
@@ -1991,9 +1991,8 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
if (model) {
providerSemaphore = getProviderSemaphore(settings, model.provider);
if (providerSemaphore) {
await awaitAbortable(providerSemaphore.acquire());
await providerSemaphore.acquire(abortSignal);
providerSemaphoreAcquired = true;
checkAbort();
}
}