Skip to content

Subagent hangs after a completed bash tool call while a detached descendant process stays alive; primary sessions unaffected #47546

Closed as not planned

Description

@Mefgner

Description

Subagent sessions (mode: subagent, launched via the task tool) stop issuing their next LLM request after a bash tool call that completes normally while a long-lived detached descendant process stays alive. The TUI keeps showing the command as executing, no error is surfaced, and the session only recovers when the user aborts it. The identical call pattern in a primary (mode: primary) session does not stall.

The trigger is the lingering detached process, not the tool call itself: the bash command provably finished (its own cleanup code ran to the end).

Patterns observed

Specific case

Any bash command that leaves a long-lived detached grandchild running reproduces it. Observed with a Playwright session browser (chosen because it makes the descendant long-lived by design):

A PowerShell wrapper (the whole bash command) runs
Start-Process node <playwright-cli.js> -s=<session> open <url> -RedirectStandardOutput/-RedirectStandardError <tempfiles> -PassThru, then WaitForExit(cap), prints the captured logs, and exits. The spawned browser daemon (node + chrome tree) stays alive by design. The wrapper exits, the bash result returns, and the subagent loop stalls before its next model request. Killing the daemon afterwards does not unstick the session.

Log signature (1.18.29)

23:33:09 evaluated permission=bash pattern="& $Pw -s=oc-subagent-probe open ..." action=allow
(no further loop/stream lines for this session)
23:37:02 process session.id=ses_... error=Aborted stack=undefined   <- user abort

For contrast, #33028's signature shows a stream ... mode=subagent line before the silence; here the next stream is never even started.

Steps to reproduce

  1. Windows 11, PowerShell 5.1, opencode 1.18.29.
  2. Define a subagent (mode: subagent) and delegate a task that runs the wrapper command above through bash.
  3. The TUI shows the open command as running; opencode.log shows the permission evaluation, then silence.
  4. Manual abort is the only recovery.

Questions

  • What does the subagent loop wait on between a completed tool result and the next completion request?
  • Is there descendant/jobs bookkeeping on the subagent path that primary sessions skip?

Happy to provide full logs, wrapper scripts, and to test patches.

Plugins

Local rewrite-only plugin (rtk.ts, tool.execute.before only); signature identical with the plugin disabled.

OpenCode version

1.18.29

Operating System

Windows 11 (10.0.26200)

Terminal

Windows Terminal

Activity

  1. github-actions commented on Sep 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    You already reference #33028 and #40468 in your report; linking back may help consolidate investigation.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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