anomalyco / anomalyco/opencode

Subagent termination does not kill spawned child processes (disk abuse risk)

Open
#38,564 2 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 23, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When a subagent (task agent) is terminated/cancelled during execution, the PowerShell child processes it spawned continue running silently in the background. The subagent's context disappears from the chat, but the disk-scanning script keeps going at 100% I/O. The only way to stop it is to close opencode entirely.

Real incident: A subagent was running a recursive Get-ChildItem scan on an F: drive (mechanical HDD, ~2TB with millions of files). The user manually terminated the subagent and resumed conversation — the script kept running. The F: drive hit 100% disk utilization. The user suspected ransomware and spent significant time debugging before discovering that quitting opencode cleared the issue.

Plugins

None (default install)

OpenCode version

Latest (via npm)

Steps to reproduce
  1. Ask opencode to perform a task that spawns a long-running subagent (e.g., recursive disk scan)
  2. The subagent executes Get-ChildItem -Path F:\ -Recurse in PowerShell
  3. Terminate/cancel the subagent via the UI
  4. Continue editing or re-entering the conversation
  5. Open Task Manager → Disk tab → F: drive stuck at 100% busy
  6. Close opencode entirely → disk activity stops immediately
Screenshot and/or share link

N/A — disk utilization was observed via Windows Task Manager

Operating System

Windows 11

Terminal

PowerShell 5.1 (Windows Terminal)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.