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)
Activity
github-actions commentedon Jul 23, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
[-]子代理终止后后端进程未释放[/-][+]Subagent termination does not kill spawned child processes (disk abuse risk)[/+]github-actions commentedon Jul 23, 2026
Thank you for updating the issue! It now meets our contributing guidelines. We appreciate the clear and detailed bug report.
github-actions commentedon Sep 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.