diff --git a/packages/kilo-vscode/src/services/cli-backend/server-manager.ts b/packages/kilo-vscode/src/services/cli-backend/server-manager.ts index 2c5cce07d13..4b08a6284e7 100644 --- a/packages/kilo-vscode/src/services/cli-backend/server-manager.ts +++ b/packages/kilo-vscode/src/services/cli-backend/server-manager.ts @@ -81,10 +81,7 @@ export class ServerManager { KILO_APP_VERSION: this.context.extension.packageJSON.version, KILO_VSCODE_VERSION: vscode.version, }, - // stdin is kept open as a keepalive pipe. The CLI watches for EOF on - // stdin and shuts itself down. This ensures the server exits even when - // the extension host is hard-killed and dispose() is never called. - stdio: ["pipe", "pipe", "pipe"], + stdio: ["ignore", "pipe", "pipe"], detached: true, }) console.log("[Kilo New] ServerManager: 📦 Process spawned with PID:", serverProcess.pid) @@ -184,9 +181,7 @@ export class ServerManager { const proc = this.instance.process this.instance = null - console.log("[Kilo New] ServerManager: 🔴 Disposing — closing stdin pipe, PID:", proc.pid) - // Closing stdin signals the CLI to shut down gracefully via its EOF watcher. - proc.stdin?.end() + console.log("[Kilo New] ServerManager: 🔴 Disposing — sending SIGTERM to process group, PID:", proc.pid) ServerManager.killProcess(proc, "SIGTERM") // SIGKILL fallback after 5s: mirrors the desktop app going straight to diff --git a/packages/opencode/src/cli/cmd/serve.ts b/packages/opencode/src/cli/cmd/serve.ts index fa58baccecc..8ccde9b7ce1 100644 --- a/packages/opencode/src/cli/cmd/serve.ts +++ b/packages/opencode/src/cli/cmd/serve.ts @@ -39,18 +39,6 @@ export const ServeCommand = cmd({ process.on("SIGTERM", shutdown) process.on("SIGINT", shutdown) process.on("SIGHUP", shutdown) - - // When spawned by the VS Code extension, stdin is kept open as a keepalive - // pipe. If the extension host is hard-killed (crash, OOM) the write-end of - // the pipe is closed by the OS, causing an EOF here. We detect that and - // trigger a clean shutdown so no zombie process is left behind. - if (process.env["KILO_CLIENT"] === "vscode") { - process.stdin.resume() - process.stdin.on("end", () => { - shutdown().catch(() => {}) - }) - } - await new Promise((resolve) => abort.signal.addEventListener("abort", resolve)) // kilocode_change end },