Skip to content

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

Closed as not planned

Description

@fewnfds

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)

Activity

  1. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The official bug report template was not used. Please use the bug report template which requires: OpenCode version, Operating System, Terminal, and Plugins fields.
    • No system information is provided (OS, terminal emulator, OpenCode version). This context is important for reproducing and diagnosing the issue.
    • No steps to reproduce have been provided in a way that includes the specific commands or actions taken (e.g. what long-running script was used, how the subagent was terminated).

    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.

  2. changed the title [-]子代理终止后后端进程未释放[/-] [+]Subagent termination does not kill spawned child processes (disk abuse risk)[/+] on Jul 23, 2026
  3. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

    Thank you for updating the issue! It now meets our contributing guidelines. We appreciate the clear and detailed bug report.

  4. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions