GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — core: background shell completion doesn't wake an idle subagent session that ended its turn · Issue #64047 · anomalyco/opencode

core: background shell completion doesn't wake an idle subagent session that ended its turn #64047

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
core: background shell completion doesn't wake an idle subagent session that ended its turn#64047
Copy link
Labels
area/coreAgent loop, tools and configtriagingtype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@tommymedeiros
tommymedeiros
opened on Nov 15, 2026
Issue body actions

A subagent session that starts a background shell and then ends its turn while the shell is still running is never resumed when the shell completes. The parent only sees the child go idle. No second round of work happens in the child, even though the shell finished long after.

What I expected, from the docs (packages/plugin/src/effect/README.md):

When one of the Session's own shells or subagents finishes, its notice wakes the Session and the hook runs again, so a plugin that waits for that work can return. Work a descendant owns, such as a shell a subagent left running, wakes that descendant instead, so it is listed for information only.

The shell was owned by the child itself, so from the parent's side this is exactly "a shell a subagent left running", and the doc says that wake goes to the descendant. From the source I read (packages/core/src/tool/plugin/shell.ts), the completion path (the notify helper, around line 135) admits the notice as a synthetic prompt with no resume: false, and the tools docs say background calls "notify the session when they finish". Session.prompt wakes execution when resume !== false, so the child should have been woken. In practice it stayed idle.

So my question: is this intended, or is the wake lost for descendant-owned background shells? I couldn't find an admission downgrade that would explain it. The README line "Notices admitted with resume: false, such as those recovered after a restart, wait for the next wake instead" would explain the stranding, but no restart was involved here. If there is a deliberate branch that admits these notices without waking at the idle boundary, I'd like to understand it so I can stop relying on it.

Steps to reproduce:

  1. From a parent session, spawn a subagent (the subagent tool, default depth).
  2. In the child, run a shell command with background: true, for example sleep 8 && echo DONE.
  3. Have the child end its turn right after, as the tool result tells it the session will be resumed automatically when the command completes.
  4. Wait past the 8 seconds.

Observed: the child was never resumed. Its turn ended and the parent received only the child's completion notification with no phase-2 output in it. The same shape reproduced live, not just in a contrived script.

Why this matters in practice: in a multi-agent workflow a child that trusts the auto-resume instruction is stranded, and the coordinating session has to notice the missing work and re-prompt the child from ground truth. We hit this three times in one day (2026-11-14) before switching our delegation prompts to never end the turn on background work.

Workaround: don't end the turn on background work. Block on the command or keep the parent waiting on the child explicitly.

One diagnostic ask: if the notice admission surfaced whether it woke the session or was admitted with resume: false (for example in the parent's subagent view), a repro like this would be confirmable in one run.

Plugins: none

Activity

  1. opencodejr commented on Nov 15, 2026

    @opencodejr
    opencodejrBot
    on Nov 15, 2026
    Contributor
    More actions

    Thanks for the detailed write-up and the source reading.

    As far as I can tell from the current code, this isn't intended. A background shell the child started itself should wake that child again when it finishes, even after the child has reported to its parent. I didn't find a branch that admits these notices with resume: false when there's been no restart. In the current code, the subagent tool also tells the parent it will get a <subagent> message when the child goes idle, "and again after each later round of work".

    What you saw from the parent's side matches a known bug: #48826. There, the child is reported to the parent as completed with its first-turn reply. When the shell finishes, the child is woken and writes its real answer, but that answer never reaches the parent. #48826 was closed when #63209 was merged, and #63209 landed after the 2.2.7 release.

    To tell whether this is the same thing or something new, could you share:

    1. Your OpenCode version (opencode --version), and the server's version if you run a separate server or service.
    2. Whether the child session's own transcript shows the <shell> completion notice followed by a second assistant turn after the 8 seconds. Your report says the child was never resumed. If you judged that from the parent's notification, the child may have resumed and only the second report was lost, which is what [BUG] V2: subagent with pending background work (shell commands or subagents, background: true) marked completed early — results never collected #48826 describes.

    You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.

    Possible duplicates and related issues, most likely first:

    • [BUG] V2: subagent with pending background work (shell commands or subagents, background: true) marked completed early — results never collected #48826: the parent gets an early completed with the first-turn reply; the child is woken by its background shell, but its later answer never reaches the parent. Closed when feat(core): report subagent results to the parent every time a child goes idle #63209 was merged.
    • subagent: background shell continuation result is not forwarded to parent #63375: the same symptom on 2.2.7 and 2.2.5, closed as a duplicate of [BUG] V2: subagent with pending background work (shell commands or subagents, background: true) marked completed early — results never collected #48826.
    • subagent: completion event fires at first idle, no event at real finish #62296: the completion event fires at the child's first idle, with no event at the real finish.
    • subagent: parent sees premature completion when a child yields on a background command #52456: the parent sees a premature completion when a child ends its turn on a background command.
    • subagent: background subagent's resumed turn completes but the parent session never receives the completion notification #50751: a background subagent's resumed turn completes, but the parent never gets the notification.
  2. opencodejr
    added
    area/coreAgent loop, tools and config
    triaging
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 15, 2026
  3. opencodejr commented on Nov 15, 2026

    @opencodejr
    opencodejrBot
    on Nov 15, 2026
    Contributor
    More actions

    We haven't heard back, so I'm closing this issue for now. To tell whether this is the known problem in #48826 or something new, we needed two things:

    • your OpenCode version (opencode --version, plus the server's version if you run one separately)
    • whether the child session's own transcript shows the <shell> completion notice followed by a second assistant turn

    In #48826, which was closed when #63209 was merged, the child did wake up. Only its later answer failed to reach the parent, and that looks the same as your report from the parent's side.

    If you can share those details, just reply here and the issue will reopen.

  4. opencodejr
    closed this as not plannedon Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreAgent loop, tools and configtriagingtype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.