Description
File: packages/core/src/tool/bash.ts:143-148
const command = ChildProcess.make(parameters.command, [], {
cwd: target.canonical,
shell,
stdin: "ignore",
detached: process.platform !== "win32",
forceKillAfter: Duration.seconds(3),
})
detached: true on non-Windows puts the command in its own process group. When Effect.timeoutOrElse fires (L157), the Effect's scope cleanup only kills the direct child — grandchild processes survive. Meanwhile bash.ts:162-170 treats timeout as a SUCCESS (timedOut: true) and returns it to the AI, so the AI may retry while the original process is still running.
Repro: AI runs a long command (e.g., npm install). It times out. AI gets "Command exceeded timeout" (not an error). AI retries. Original npm is still writing to node_modules. Race condition → corruption.
Fix: Remove detached or add explicit process-group cleanup on timeout.
OpenCode version
v1.16.0 (commit 3cf1cef)
Description
File:
packages/core/src/tool/bash.ts:143-148detached: trueon non-Windows puts the command in its own process group. WhenEffect.timeoutOrElsefires (L157), the Effect's scope cleanup only kills the direct child — grandchild processes survive. Meanwhilebash.ts:162-170treats timeout as a SUCCESS (timedOut: true) and returns it to the AI, so the AI may retry while the original process is still running.Repro: AI runs a long command (e.g.,
npm install). It times out. AI gets "Command exceeded timeout" (not an error). AI retries. Original npm is still writing tonode_modules. Race condition → corruption.Fix: Remove
detachedor add explicit process-group cleanup on timeout.OpenCode version
v1.16.0 (commit 3cf1cef)