You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(opencode): zombie processes from detached shell children on Linux #29506
tool/shell.ts spawns child shell processes with detached: true on Linux, causing zombie processes to accumulate over multiple opencode run sessions.
Root Cause
In packages/opencode/src/tool/shell.ts:304:
detached: process.platform!=="win32",
On Linux this spawns shell processes via setsid() into their own process group/session. When these child processes exit before the parent calls waitpid(), and with no SIGCHLD handler anywhere in the codebase, they become <defunct> zombie processes.
Observed: 8 opencode run sessions accumulated 11 zombie processes. The only fix was kill -9 on the parent opencode processes.
Proposed Fix
Change line 304 to detached: false on all platforms:
detached: false,
Without setsid(), child processes remain in the parent's process group. Node.js can properly reap them when handle.exitCode resolves. Explicit process cleanup is already handled via handle.kill() in abort/timeout paths, so signal isolation via detached is unnecessary.
Activity
github-actions commentedon May 27, 2026
This issue might be a duplicate of existing issues. Please check:
<defunct>zombie child processes in opencode-cli, withdetached: trueincross-spawn-spawner.tsidentified as a contributing factor — closely related root cause and symptomIf there is overlap, consider coordinating or referencing each other's findings.
fix(opencode): remove shell tool detached flag to prevent zombie proc…
github-actions commentedon Jul 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.