fix: drop duplicate notifySlotAvailable() in SDK child exit handler

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) <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-05-04 20:47:08 -07:00
parent 4e49dcf445
commit 0cc45c6e7f
-1
View File
@@ -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) {