From 0cc45c6e7f3bf970401c44a0231bd3488d3d375d Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Mon, 4 May 2026 20:47:08 -0700 Subject: [PATCH] fix: drop duplicate notifySlotAvailable() in SDK child exit handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeRabbit flagged a duplicate slot wakeup: spawnSdkProcess's child 'exit' handler called registry.unregister(recordId) and then notifySlotAvailable() unconditionally. Registry.unregister() already fires notifySlotAvailable() internally when removing an SDK entry, so the trailing call woke a second waiter for the same freed slot — both could see count < maxConcurrent in the same synchronous tick before either replacement registered, transiently exceeding maxConcurrent. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/supervisor/process-registry.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/supervisor/process-registry.ts b/src/supervisor/process-registry.ts index 48f72c97..e6b3e471 100644 --- a/src/supervisor/process-registry.ts +++ b/src/supervisor/process-registry.ts @@ -586,7 +586,6 @@ export function spawnSdkProcess( logger.warn('SDK_SPAWN', `[session-${sessionDbId}] Claude process exited`, { code, signal, pid }); } registry.unregister(recordId); - notifySlotAvailable(); }); if (!child.stdin || !child.stdout || !child.stderr) {