From ca559acb3f69b2c6324140bfdaaa61083d51c05e Mon Sep 17 00:00:00 2001 From: Fork Less Date: Thu, 25 Jun 2026 01:50:40 +0200 Subject: [PATCH] fix: delay exit on stdin close to prevent MCP instability --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);