From c50eab8e4fa8438d10cbf2c9fac61d99bda5883e Mon Sep 17 00:00:00 2001 From: osherove Date: Mon, 15 Jun 2026 20:40:01 +0000 Subject: [PATCH] fix(kiro): disable detached spawn to prevent EBADF in containers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node.js spawn with detached:true causes 'Bad file descriptor (os error 9)' in containerized environments (e.g. AgentSpaces, Docker). The child process inherits stdio pipes that become invalid when detached from the parent's process group. Setting detached:false fixes the issue. Process cleanup still works via direct proc.kill() — the process group kill (killGroup) is a fallback that's unnecessary when the parent manages the child directly. --- src/agents/kiro/acp/process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agents/kiro/acp/process.ts b/src/agents/kiro/acp/process.ts index c7ea1d1..1709846 100644 --- a/src/agents/kiro/acp/process.ts +++ b/src/agents/kiro/acp/process.ts @@ -35,7 +35,7 @@ export function spawnKiroCli(opts: SpawnOptions): AcpProcess { cwd, env: { ...process.env, ...env }, stdio: ["pipe", "pipe", "pipe"], - detached: true, // own process group for clean kill + detached: false, // disabled: detached causes EBADF in containers }); // Handle spawn failures (e.g. ENOENT if kiro-cli not on PATH)