Skip to content

[FEATURE]:Restore Foreground Subagent Execution #64073

Backlog

Description

@wangzheruoyun
IMG_20261115_214804

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

Restore Foreground Subagent Execution

Since subagents are now forced to run in the background, the parent agent gets flooded with unnecessary status updates, repeated completion checks, and messages like "I'm waiting for subagent X to finish."

This pollutes the parent agent's context, wastes tokens, and distracts it from the actual task.

Please consider restoring the ability to choose between foreground (synchronous) and background (asynchronous) execution.

Background execution is useful for parallel tasks, but synchronous execution is equally important when the parent agent needs the result immediately.

Let the agent choose how to execute subagents instead of forcing every subagent to run in the background.

Activity

  1. opencodejr commented on Nov 15, 2026

    @opencodejr
    Contributor

    Thanks for the request, @wangzheruoyun! You're asking to bring back a choice between foreground (blocking) and background subagents. Then the parent agent can wait for a result it needs right away, without its context filling up with waiting and status messages.

    For context: #63382 made subagents always run in the background and removed the subagent tool's background option. The tool's description now tells the model that subagents always run in the background and not to sleep, poll, or check on the child's progress. Your report says models still produce "waiting for subagent X" turns, which is useful feedback on that design.

    Maintainers will consider this; I can't promise an outcome or a timeline. Related issues and PRs:

  2. added
    area/core
    type/feature
    version/v2
    on Nov 15, 2026
  3. wangzheruoyun commented on Nov 15, 2026

    @wangzheruoyun
    Author

    Thanks for the request, @wangzheruoyun! You're asking to bring back a choice between foreground (blocking) and background subagents. Then the parent agent can wait for a result it needs right away, without its context filling up with waiting and status messages.

    For context: #63382 made subagents always run in the background and removed the subagent tool's background option. The tool's description now tells the model that subagents always run in the background and not to sleep, poll, or check on the child's progress. Your report says models still produce "waiting for subagent X" turns, which is useful feedback on that design.

    Maintainers will consider this; I can't promise an outcome or a timeline. Related issues and PRs:

    Thanks for the request, @wangzheruoyun! You're asking to bring back a choice between foreground (blocking) and background subagents. Then the parent agent can wait for a result it needs right away, without its context filling up with waiting and status messages.

    For context: #63382 made subagents always run in the background and removed the subagent tool's background option. The tool's description now tells the model that subagents always run in the background and not to sleep, poll, or check on the child's progress. Your report says models still produce "waiting for subagent X" turns, which is useful feedback on that design.

    Maintainers will consider this; I can't promise an outcome or a timeline. Related issues and PRs:

    Could you help me put a "important" label on it? Thanks so much!

  4. GigAnon commented on Nov 15, 2026

    @GigAnon

    Same issue here (#64096)

  5. wangzheruoyun commented on Nov 15, 2026

    @wangzheruoyun
    Author

    Same issue here (#64096)

    💔There's still no PR dedicated to fixing this issue yet, bro. What solutions have you tried?

  6. GigAnon commented on Nov 15, 2026

    @GigAnon

    Same issue here (#64096)

    💔There's still no PR dedicated to fixing this issue yet, bro. What solutions have you tried?

    Updated my agents and system prompts from this (which set background: true 100% of the time w/ qwen3.8):

    Every subagent call waits for its answer: never set background on the subagent tool, even for a live run of several hours. A backgrounded subagent ends your turn early [...]

    To this:

    A subagent call returns at once and the child runs in the background. After a dispatch, do nothing else: no model-driven work, no other dispatch unless the plan runs them in parallel. End the turn only to wait: the child's <subagent> report starts your next turn. A report that says the child's own background work is still running is not a result: wait for the next one. Treat the child as done only when its result file exists and wc -l fits the size table.

    I have only started running the tests on opencode 2.3.0 a few hours ago, so results are still coming in. So far, it's flaky: I've seen active wait through subagents_wait, but agents in the current work session have decided to give the hand back and end their round instead (I don't know yet if that's going to work, TBC).

    I have much larger unattended workflows coming up this week, I may have to rollback 2.3.0 migration posthaste depending on the results.

    EDIT: well, as it turns out, when you have nested subagents, it's complete mess.
    Say you have: A -> B -> C1, A -> B -> C2, etc.
    EVERY TIME B spawns a subagent and decides to end its turns, it wakes up A for no reason.
    Just look at this mess! 'Build' is being woken up TWICE per nested subagent: once when it's spawned, and once when it's completed.
    And this has only been running for a couple hours at a pedestrian pace, I can't imagine the disaster this would be at 1000+ tok/s...
    Or, for that matter, with an even greater subagent depth. It compounds really fast!

    image image
  7. wangzheruoyun commented on Nov 15, 2026

    @wangzheruoyun
    Author

    Same issue here (#64096)

    💔There's still no PR dedicated to fixing this issue yet, bro. What solutions have you tried?

    Updated my agents and system prompts from this (which set background: true 100% of the time w/ qwen3.8):

    Every subagent call waits for its answer: never set background on the subagent tool, even for a live run of several hours. A backgrounded subagent ends your turn early [...]

    To this:

    A subagent call returns at once and the child runs in the background. After a dispatch, do nothing else: no model-driven work, no other dispatch unless the plan runs them in parallel. End the turn only to wait: the child's <subagent> report starts your next turn. A report that says the child's own background work is still running is not a result: wait for the next one. Treat the child as done only when its result file exists and wc -l fits the size table.

    I have only started running the tests on opencode 2.3.0 a few hours ago, so results are still coming in. So far, it's flaky: I've seen active wait through subagents_wait, but agents in the current work session have decided to give the hand back and end their round instead (I don't know yet if that's going to work, TBC).

    I have much larger unattended workflows coming up this week, I may have to rollback 2.3.0 migration posthaste depending on the results.

    I'm going to use this command to roll back to the previous version. I can't stand the current version anymore

    opencode upgrade 2.2.7

  8. gugglegum commented on Nov 16, 2026

    @gugglegum

    I also really need to be able to run sub-agents in the foreground (interrupting the main agent). I use a self-hosted AI server with only one slot; it CANNOT handle more than one connection at an acceptable speed. Previously (as I understand it), there was an option to choose how a sub-agent could be invoked, but that option is no longer available. This update (2.3.0) has reduced the available choices and restricted the use of self-hosted models.

  9. GigAnon commented on Nov 16, 2026

    @GigAnon

    Below copy of my post on #64096, as requested by @opencodejr bot.
    Human maintainers reading this, PLEASE read #64096 as well. It has more details as to why this is a terrible idea to remove the option to programmatically pause the parent agent.

    image It was predictable, now seen on the field - after a few rounds of waiting, the main agent will ABSOLUTELY start going astray and run troubleshooting. Also seen on the field: agents not following the 'soft steering' directives, and deciding that "loading a skill" wasn't actually anything. Cue 10 mins of 3 (or 4) sessions trashing one another on a 2-sessions setup (and 'only 10 mins' was sheer luck - there was no cache eviction or compaction).

    EDIT: oh great, subagents idle answers can trigger compaction, too. That's surely not going to cause any issues down the line!

  10. GigAnon commented on Nov 17, 2026

    @GigAnon

    Some stats, before and after I rolled back 2.3.0:

    Short version: 2.3.0 cost about 30–50 minutes over roughly 30 hours (≈2%, 1 h as a ceiling. The compaction trigger is about 172k tokens in both versions.

    1. Time lost to 2.3.0’s always-background subagents

    The mechanism shows up clearly in the data. Under 2.3.0 the subagent call returns in about 13 ms with no result, and the result comes back later as a synthetic message. Under 2.2.7 the call blocks until the child finishes. For example, the F9 resume call ran 22:48 → 23:38.

    The costs I could measure:

    Status chatter. The orchestrator ended a turn after each dispatch, and each of those turns woke the build session with a state="running" notice. There were 31 of them. Each cost a ~45 s turn, about 22 min of generation in total. The orchestrator’s own status-only turns add about 9 min. Under 2.2.x all of this is zero.
    Gate contention. Token generation never overlapped across sessions (0 of 1,632 turns), so the gate serializes everything. Worker turns that queued behind parent turns waited about 40 min longer for their first token (implementer 21 min, reviewer 10.5, auditor 6, general 2). This is an upper bound, because some of the orchestrator’s overlapping turns were useful, such as checking screenshots during the F5 live run.
    Migration downtime. All three active sessions were cancelled at 22:39:52, and the sessions resumed between 22:46 and 22:48. That is about 7–8 min of dead time.
    The orchestrator blamed an “LLM-gate timeout”. The simultaneous timestamp points to the 2.3.0 server being stopped instead; the 2.2.7 service started at 22:44:47.
    Compaction right after a dispatch. This happened twice, at 02:23 and 21:59. The orchestrator then had to rebuild whether its child was still running, about a minute each.

  11. 18 remaining items

  12. Dr-Hughes commented on Nov 25, 2026

    @Dr-Hughes

    @neriousy Just trying to get eyes on this before it becomes harder to revert. I noticed you mention the PR that caused this problem here: #49216
    ...as well as a closed PR here #61414 (@YMoose)

    So just to clarify, are y'all doubling down on leaving this in place? If so that's obviously up to you folks, but if that's going to be the case, then my 2 cents would be to close this issue with some explanation as you see fit. Frankly I think that is going to be an uptick in Pi users xD, but so we know one way or the other.

    Been using opencode for almost a year now and constantly telling people how great it is. It's almost embarrassing now that I've migrated to Pi and miss a lot of the strengths of opencode and literally can't use it because it's so stupidly broken for locally hosted models now.

  13. GeneralProtectionFault commented on Nov 25, 2026

    @GeneralProtectionFault

    @neriousy Just trying to get eyes on this before it becomes harder to revert. I noticed you mention the PR that caused this problem here: #49216
    ...as well as a closed PR here #61414 (@YMoose)
    So just to clarify, are y'all doubling down on leaving this in place? If so that's obviously up to you folks, but if that's going to be the case, then my 2 cents would be to close this issue with some explanation as you see fit. Frankly I think that is going to be an uptick in Pi users xD, but so we know one way or the other.

    Been using opencode for almost a year now and constantly telling people how great it is. It's almost embarrassing now that I've migrated to Pi and miss a lot of the strengths of opencode and literally can't use it because it's so stupidly broken for locally hosted models now.

    I mean if I were a conspiracy theorist, I'd think this was to push people towards purchasing Zen lol, but folks above have pointed out it seriously messes with workflows even if it's not local. I don't understand why it's a popular workflow at all unless you're building very separate modules to an application.

    However, I think it's more tone deafness, like coming from the standpoint of just vomiting text at a huge model with no practical limit. They actually added the experimental config so requests wouldn't time out after 60 minutes, before which I just used something else, because that also broke my local workflow.

    That said, there are alternatives, I'm using oh-my-pi, and curious to try Jcode out. I might come back to opencode if they un-feck this xD, but there are actually some things others do better like subagent steering, etc...

  14. wangzheruoyun commented on Nov 25, 2026

    @wangzheruoyun
    Author

    @neriousy Just trying to get eyes on this before it becomes harder to revert. I noticed you mention the PR that caused this problem here: #49216
    ...as well as a closed PR here #61414 (@YMoose)
    So just to clarify, are y'all doubling down on leaving this in place? If so that's obviously up to you folks, but if that's going to be the case, then my 2 cents would be to close this issue with some explanation as you see fit. Frankly I think that is going to be an uptick in Pi users xD, but so we know one way or the other.

    Been using opencode for almost a year now and constantly telling people how great it is. It's almost embarrassing now that I've migrated to Pi and miss a lot of the strengths of opencode and literally can't use it because it's so stupidly broken for locally hosted models now.

    I mean if I were a conspiracy theorist, I'd think this was to push people towards purchasing Zen lol, but folks above have pointed out it seriously messes with workflows even if it's not local. I don't understand why it's a popular workflow at all unless you're building very separate modules to an application.

    However, I think it's more tone deafness, like coming from the standpoint of just vomiting text at a huge model with no practical limit. They actually added the experimental config so requests wouldn't time out after 60 minutes, before which I just used something else, because that also broke my local workflow.

    That said, there are alternatives, I'm using oh-my-pi, and curious to try Jcode out. I might come back to opencode if they un-feck this xD, but there are actually some things others do better like subagent steering, etc...

    I think Hermes is pretty good right now - the configuration file is clear, the code is solid, and initialization is really easy with your own third-party API. Honestly, you should give it a try

  15. neriousy commented on Nov 26, 2026

    @neriousy
    Member

    Foreground subagents were deliberately removed in #63382 (66e2fb94) and #63223 (f5f5190d) so all subagents run asynchronously via <background-result> jobs. We aren't bringing back blocking subagent calls, so closing as not planned.

  16. Dr-Hughes commented on Nov 26, 2026

    @Dr-Hughes

    Hi @neriousy, I worry that you've closed this without understanding that this is a bug, not a feature. It is a breaking change.

  17. Dr-Hughes commented on Nov 26, 2026

    @Dr-Hughes

    multiple people already flagged in #63382 that this was a bad idea and it was completely ignored. Why even have a project be open source if you will willingly ignore when users tell you of bugs and then act as if it is intentional?

  18. JSApps7 commented on Nov 26, 2026

    @JSApps7

    Foreground subagents were deliberately removed in #63382 (66e2fb94) and #63223 (f5f5190d) so all subagents run asynchronously via <background-result> jobs. We aren't bringing back blocking subagent calls, so closing as not planned.

    But... why? You all really see absolutely no reason/use for deterministic blocking calls to at least be an option?

    Are there any fixes in the pipeline to expand on better deterministic subagent return handling within the async model, or do we need to open more specific Issues? It seems that any new reference to background issues were being closed and redirected here, which is a dead end now since it's attached to proposing to bring back the blocking calls.

  19. wangzheruoyun commented on Nov 26, 2026

    @wangzheruoyun
    Author

    I really don't want to use conspiracy theories to explain anything - that's completely irresponsible and just a way to avoid dealing with the issue!

  20. neriousy commented on Nov 26, 2026

    @neriousy
    Member

    We are taking a look at it

  21. dudzcom commented on Nov 26, 2026

    @dudzcom

    My observations:

    1. Context filled with noise
    With a simple 3-layer agent structure, the grandparent (root) is continuously woken up by a copious amount of noise from subagents (parents) checking in just to say that a child (child-leaf) has progressed through another step. For long-running processes, the grandparents are woken hundreds or thousands of times, greatly polluting context with noise.

    2. Abstraction, Encapsulation, and Separation of Concerns
    Explicitly chosen divisions of labor between agents has been violated. Whereas a subagent was designed to be a black-box that can solve a problem with a unique set of tools they have access to, now the the caller is constantly informed about the internal status of the subagent. This violates basic tenants of Abstraction, Encapsulation, and Separation of Concerns.

    From my perspective, this is clearly a regression; and if not clearly addressed, we will be forced to continue using OpenCode v1, or build an internal fork of the codebase ourselves.

    edit: typo

  22. wasiejen commented on Nov 26, 2026

    @wasiejen

    I have also stopped upgrading past v2.2.7 due to this breaking change.

    This is a basic feature that many local serial agent workflows rely on, and it is hard to understand why it was removed without even an opt-in path. With the current rate of feature creep in OpenCode, new behavioral changes should really be opt-in—or at least opt-out. Having that choice is a fundamental cornerstone of open-source software. Leaving users to choose between freezing updates, maintaining a fork, or moving to another agent harness signals that something is off with the release approach.

    Sorry if this comes across as pointed. I like OpenCode a lot and appreciate the project, which makes it all the more frustrating to deal with this right after investing heavy effort into migrating my plugins from v1 to v2. Routine breaking changes are forcing me to consider migrating my setup elsewhere.

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/coretype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions