opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[Windows] AI killing node.exe process terminates OpenCode itself

Open SYRS-AI opened this issue 3 days ago • 0 comments

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:

  1. The AI frequently needs to manage dev servers (start/stop/restart)
  2. Using taskkill /IM node.exe is a common pattern for process management on Windows
  3. 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

  1. Start opencode on Windows
  2. Ask AI to start a Node.js dev server (e.g., npm run dev)
  3. The server runs in a separate terminal/process
  4. Ask AI to restart the server or kill the Node process
  5. AI executes taskkill /F /IM node.exe
  6. OpenCode terminates unexpectedly along with the target process

Expected behavior

OpenCode should either:

  1. Prevent the AI from executing commands that would terminate its own process
  2. Use process-specific termination (by PID) rather than image name
  3. 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.

SYRS-AI avatar Jan 12 '26 09:01 SYRS-AI