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

Open
opened 2026-02-16 17:45:37 -05:00 by yindo · 0 comments
Owner

Originally created by @SYRS-AI on GitHub (Jan 12, 2026).

Originally assigned to: @thdxr on GitHub.

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.

Originally created by @SYRS-AI on GitHub (Jan 12, 2026). Originally assigned to: @thdxr on GitHub. ### 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: ```bash 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.
yindo added the windows label 2026-02-16 17:45:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4831