diff --git a/src/index.ts b/src/index.ts index fcec8c8..2ba90c1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3003,7 +3003,8 @@ async function runServer(): Promise { } server.onclose = shutdown; - process.stdin.on('close', shutdown); + // Delay exit on stdin close — prevents crash if CodeWhale briefly disconnects during init + process.stdin.on('close', () => setTimeout(shutdown, 1000)); process.on('SIGTERM', shutdown); process.on('SIGINT', shutdown);