Skip to content

[FEATURE]: add a built-in wait_for_subagents tool #58402

Open

Description

@Evan-Du-037

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I'd like to bring my wait_for_subagents plugin into OpenCode as a built-in tool. This follows up on the discussion in #47105 and the waiting problem reported in #41172, which was closed as stale.

I've had agents start a background subagent, do some work themselves, then start repeating the delegated work because the result hadn't arrived yet. The missing step is a way for the parent to say: "I'm done with my part; wait for these subagents before I continue."

The tool would take session IDs from native background subagent calls and an optional timeout. The parent could keep working after launching the subagents and call wait_for_subagents when it needs their results. The call would wait until the selected completion notifications are queued or already in context, or until the timeout expires. A timeout would report what's still pending without cancelling the children.

Results would still arrive through OpenCode's native notifications. The tool wouldn't inject another copy of the results or start a second parent response.

Since OpenCode already provides background subagents, I think waiting for them should be available out of the box too. The plugin was tested on 2.0.26 and 2.0.27; I'd recheck it against current dev as part of the implementation.

Would you be open to adding this? I'm happy to put together the PR once the approach is approved.

Activity

  1. opencode-agent commented on Oct 23, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed proposal, @Evan-Du-037! To restate it: you'd like a built-in wait_for_subagents tool. A parent agent could keep working after starting background subagents, then wait for specific ones by session ID, with an optional timeout. Results would still arrive through the normal completion notifications, and a timeout wouldn't cancel the children. Maintainers will consider whether to add this and how it should work. Please wait for their feedback before opening a PR.

    In the meantime, your plugin is a working option for anyone who needs this now: https://github.com/Evan-Du-037/opencode-wait-for-subagents

    Related issues:

  2. everest-an commented on Oct 23, 2026

    @everest-an

    +1 — this covers the "parent keeps working, then waits" half of the problem.

    The related task-parallel request in #47105 covers the other half: fan out 2–5 independent subtasks at once, wait for all of them, and return one combined summary. That implementation PR (#47107) was auto-closed by the stale-PR bot, and its branch predates the packages/core/src/tool/plugin/ restructure, so it needs a port rather than a rebase.

    If maintainers are open to both, I am happy to port task-parallel to the current architecture and open a fresh PR referencing #47105. Either way, a built-in wait_for_subagents is a clear win for the duplicate-work failure mode.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions