opencode
opencode copied to clipboard
[Windows] AI killing node.exe process terminates OpenCode itself
Description
On Windows, when the AI agent uses taskkill /F /IM node.exe to terminate a Node.js process (e.g., to restart a dev server), it inadvertently kills OpenCode itself because OpenCode also runs on Node.js.
This is a critical issue for Windows users because:
- The AI frequently needs to manage dev servers (start/stop/restart)
- Using
taskkill /IM node.exeis a common pattern for process management on Windows - There's no built-in safeguard to prevent the AI from terminating its own parent process
OpenCode version
Latest (as of 2026-01-12)
Steps to reproduce
- Start
opencodeon Windows - Ask AI to start a Node.js dev server (e.g.,
npm run dev) - The server runs in a separate terminal/process
- Ask AI to restart the server or kill the Node process
- AI executes
taskkill /F /IM node.exe - OpenCode terminates unexpectedly along with the target process
Expected behavior
OpenCode should either:
- Prevent the AI from executing commands that would terminate its own process
- Use process-specific termination (by PID) rather than image name
- Warn the AI/user before executing potentially self-destructive commands
Workaround
Use PID-specific termination instead of image name:
taskkill /F /PID <specific_pid>
Or use psmux/tmux alternatives for session management where processes can be managed independently.
Environment
- OS: Windows 11
- Shell: Git Bash / PowerShell
- Terminal: Windows Terminal
Related Issues
- #5525 (bash.exe orphan processes)
- #7074 (CTRL_C_EVENT handling)
This issue is distinct as it's about the AI agent self-terminating by killing all node.exe processes indiscriminately.