feat(DIS-104): global semaphore for max_concurrent_agents cap #44

Merged
dev merged 1 commit from phase-1/concurrency-semaphore into main 2026-04-09 15:30:01 +00:00
Owner

Summary

  • Add Semaphore class in src/runtime/concurrency.ts (pure TypeScript, no new deps)
  • runAgent() in runner.ts acquires a slot before spawning Claude CLI and releases it in finally
  • max_concurrent_agents added to DisclawConfig (default 4), configurable in disclaw.yaml
  • 5 unit tests in tests/unit/semaphore.test.ts covering happy path, queueing, FIFO order, and error-path release

Test plan

  • npm run build � TypeScript compiles without errors
  • npm test � all 40 tests pass (8 test files)
  • Semaphore queues callers correctly when all slots are occupied
  • finally block guarantees release even when the spawn rejects
## Summary - Add `Semaphore` class in `src/runtime/concurrency.ts` (pure TypeScript, no new deps) - `runAgent()` in `runner.ts` acquires a slot before spawning Claude CLI and releases it in `finally` - `max_concurrent_agents` added to `DisclawConfig` (default 4), configurable in `disclaw.yaml` - 5 unit tests in `tests/unit/semaphore.test.ts` covering happy path, queueing, FIFO order, and error-path release ## Test plan - [x] `npm run build` � TypeScript compiles without errors - [x] `npm test` � all 40 tests pass (8 test files) - [x] Semaphore queues callers correctly when all slots are occupied - [x] `finally` block guarantees release even when the spawn rejects
dev added 1 commit 2026-04-09 15:09:13 +00:00
feat(DIS-104): global semaphore for max_concurrent_agents cap
Some checks failed
CI / build-and-test (ubuntu-latest) (pull_request) Has been cancelled
CI / build-and-test (windows-latest) (pull_request) Has been cancelled
CI / lint (pull_request) Has been cancelled
04450bb6d9
Add Semaphore class in src/runtime/concurrency.ts.
Runner acquires/releases slot around claude spawn.
Default cap: 4, configurable via disclaw.yaml max_concurrent_agents.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev merged commit 86683297af into main 2026-04-09 15:30:01 +00:00
dev deleted branch phase-1/concurrency-semaphore 2026-04-09 15:30:07 +00:00
Sign in to join this conversation.
No description provided.