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 — subagent: completion event fires at first idle, no event at real finish · Issue #62296 · anomalyco/opencode

subagent: completion event fires at first idle, no event at real finish #62296

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
subagent: completion event fires at first idle, no event at real finish#62296
Copy link
Labels
pending closetriaging

Description

@peppekerstens
peppekerstens
opened on Nov 6, 2026
Issue body actions

Summary

A subagent completion notification is emitted when the child session first goes idle, not when the child's work ends. When a child waits on a background shell, the parent receives state="completed" while the child still works. The real finish sends no second event, so the parent stays idle until the user types.

Environment

  • opencode version: 2.2.5
  • OS: Linux 7.0.0-38-generic x86_64 (Ubuntu)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor (opencode TUI)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: caveman, asd-ste100

Reproduction

  1. Spawn a background subagent (background: true). Its task starts a long background shell job, then ends its turn and waits for the job.
  2. The child goes idle while the shell job runs.
  3. In the parent, observe the synthetic subagent event: metadata.state = "completed", while the child's last text says the work continues.
  4. The shell job ends. The child wakes on the shell completion event and writes the final report.
  5. Observe that no second subagent event reaches the parent.

Expected Behavior

  • state="completed" only when the child session has no pending work.
  • An event (or a state update) when the child finally ends.

Actual Behavior

  • The parent gets state="completed" at the child's first idle.
  • No event arrives at the real finish.
  • The parent idles indefinitely. Only a user message resumes the session.

Measured on one session (ses_e6328c204ffe0bFi0yELaa7OnI, 24 subagents): 4 early notifications. Gap between the notification and the real last message: 226 s, 483 s, 2057 s, 5851 s.

Additional Context

Worked example, child ses_e508d5162ffeX4osMnA0F9exEU:

  • 07:06:24 child idle. Parent event: state="completed", body "Checks 1, 3, 4 done. Check 2 (M5 gate) still running in background. Waiting for its completion notification..."
  • 07:06:26 the background shell completes. The child resumes.
  • 07:08:14 the child writes the final report.
  • 07:10:11 the child idles again. No event to the parent.
  • The parent stayed idle until the user typed at 07:17:38 and again at 07:19:35.

The second reported symptom (parent says a subagent is done, or says it is still running) has the same root cause: one event claims completed while its body says the child is still working.

Suggested fix: emit the subagent event on the child's terminal state, when no background job is pending. Alternatively send repeated state updates per child instead of one deduplicated event.

Workaround: no subagents. Run the work on the main thread and use background shell jobs.

Activity

  1. opencodejr commented on Nov 6, 2026

    @opencodejr
    opencodejrBot
    on Nov 6, 2026
    Contributor
    More actions

    Thanks for the detailed report and the timings. I think this is a duplicate of #48826: a subagent with a pending background shell is reported to the parent as completed when it first goes idle, and its real final answer after the shell wakes it never reaches the parent.

    Possible duplicates and related items, ordered from most to least likely:

    • [BUG] V2: subagent with pending background work (shell commands or subagents, background: true) marked completed early — results never collected #48826: same bug. The early completed notification carries the interim reply, and the final result is stranded in the child session. A maintainer has acknowledged it.
    • feat(core): subagents report to their parent every time they finish #61833: open PR that holds the subagent report until the child's background work is done and reports every time the child finishes.
    • fix(core): wait for background jobs before reporting subagent result #57418: open PR that waits for the child's background jobs before reporting its result.
    • fix(core): report every subagent result to its parent when it goes idle #60360: open PR that reports every subagent result to the parent whenever the child goes idle.
    • fix(core): wait for subagent background jobs before completing #57132: earlier open PR that waits for subagent background jobs before completing.

    Your measurements (the 4 early notifications and the gaps up to 5851 s) would be useful context on #48826.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencodejr
    added
    pending close
    triaging
    on Nov 6, 2026
  3. opencodejr
    closed this as duplicateon Nov 7, 2026
  4. opencodejr commented on Nov 7, 2026

    @opencodejr
    opencodejrBot
    on Nov 7, 2026
    Contributor
    More actions

    Closing this as a duplicate of #48826. We waited a day and there was no reply saying how this differs. That issue covers the same bug: a subagent with a pending background shell is reported as completed at its first idle, and its real final answer never reaches the parent. Please follow #48826 for updates. The open PRs #61833 and #57418 address it. Your timing measurements would still be useful context there. If your problem turns out to be different, reply here and we can reopen.

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

    pending closetriaging

    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.