anomalyco / anomalyco/opencode
Subagent termination does not kill spawned child processes (disk abuse risk)
@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
- Ask opencode to perform a task that spawns a long-running subagent (e.g., recursive disk scan)
- The subagent executes Get-ChildItem -Path F:\ -Recurse in PowerShell
- Terminate/cancel the subagent via the UI
- Continue editing or re-entering the conversation
- Open Task Manager → Disk tab → F: drive stuck at 100% busy
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.