Repository navigation
Description
Description
In the OpenCode TUI, the parent committed its changes and sent a final “done” report while a native subagent was still working. The subagent later sent its first <subagent state="completed"> report, which woke the parent and resulted in a second assistant reply without another user prompt.
In the latest case, the parent assigned one new code-fixer session a test file and a syntax check. The parent owned implementation and final integration testing. They shared the workspace, so the parent could see the test file, run the full integration suite successfully, and commit before the child reported back. The child was still trying its own database test when the parent declared the work complete. Code edits were disjoint. Syntax checks and execution of the new cases overlapped.
I expect the parent to be able to yield while a required child runs, then review its report before committing or declaring the task complete. A pending-work state or a native wait/join option would make this reliable without polling and would still allow independent parent work in parallel.
Plugins
Oh My OpenCode Slim was disabled for this occurrence. The server config declares plugins: []. Local plugin files are present for Herdr agent state, Magpie model integration, and RTK. The CLI config enables the Herdr plugin. A run with all local plugins disabled is still pending.
OpenCode version
opencode v2.3.2 (V2 CLI/TUI). Parent model route magpie/auto/gpt-6.2-sol. Configured child route magpie/group/auto-deepseek-flash#high.
Steps to reproduce
- Use a global
AGENTS.mdthat delegates bounded work to native subagents, assigns non-overlapping files, and makes the parent responsible for reviewing results and final verification. My configuration definescode-fixer,designer,fast-generic,oracle, andrepo-scout. The affected turn used onlycode-fixerin a fresh child session. My rules call for fresh sessions for independent tasks and reuse only for follow-ups to the same task. - Ask the parent to finish a change. Have it delegate a regression test and syntax check to the child while implementing the production change itself. The child writes its file and continues checking it.
- Let the parent run integration checks after the child's file appears. In the observed turn, the parent then committed and reported completion before the native child report arrived.
- Leave the session open without sending another prompt. Observe the late child report and the additional parent reply. Similar premature “done” reports have occurred repeatedly in my workflow. These steps describe the observed case, and I have not established a deterministic minimal reproduction.
Related reports
My earlier Slim report documented repeated replays of previously delivered results. The latest occurrence involved one late first delivery from the native tool. I would like to understand whether OpenCode can support waiting for required child results before a parent finalizes. This may involve model behavior as well as the native tool lifecycle. OMO Slim #1940 · OpenCode #63785 · OpenCode #64073
Operating System
macOS 13.3 (Darwin 22.4.0, x86_64).
Terminal
OpenCode TUI in Herdr, TERM=xterm-256color, COLORTERM=truecolor, /bin/zsh.
Activity
opencodejr commentedon Nov 21, 2026
Thanks for the detailed write-up, @tlerbao. You're asking for a way to make the parent wait for a required subagent's report before it commits or says the task is done, while it can still do its own independent work in the meantime. For example, a wait/join step or a "pending work" state.
For context, here's how it currently works: in v2, subagents always run in the background. The subagent call returns right away with a
sessionID, and the parent gets a<subagent>message each time the child goes idle. The tool tells the model to "Keep working on non-overlapping tasks, or briefly tell the user what you launched and end your response. Do not sleep, poll, or proactively check on the child's progress." In the code I read, I found no join step that keeps the parent from finishing while a child is still running. So whether it waits depends on the model, which fits what you saw: the parent ended its turn, then the child's report started another one. That's why I'm treating this as a feature request rather than a bug.Maintainers will consider it; I can't promise an outcome or a timeline. Related issues:
exploresubagent's results arrivebackground: falseoption alongside background runsshaojunying commentedon Nov 21, 2026
I reproduced this on
dev(edacc8686a) with a scripted test model, so the timing is deterministic and does not depend on model behavior.Repro. The parent calls
subagent, then returns "All done. I committed the change." The child blocks on a foreground shell until the test releases it. Results (5/5 runs):running.experimental.idlereceives the child inbackground. Core knows the child is outstanding.<background-result kind="subagent">report wakes the parent. The parent makes a third model request. The session has one user message.Root cause. Ending the turn is the only way for the model to wait. The runtime treats "turn ended with own subagents running" the same as "task done". The parent sees that a child is running only once, in the tool result at launch (
tool/plugin/subagent.ts:217). Later steps have no signal that results are still pending. When the model decides to commit or report completion, it cannot see the running child. The idle boundary already computes outstanding work (session/runner/llm.ts:182), but core only passes it to the hook.Proposal. This keeps the background-only model from #63382.
contexthook thatsubagent.tsalready registers adds a transient reminder near the tail. The reminder lists the children and says not to commit or report completion for work that depends on them. It uses the same pattern and filter as the goal plugin (plugin/goal.ts:150-160and:224-235). With no running children, the hook adds nothing. This also targets agents: subagent "work in background" pattern leads to hallucinated answers when no independent work exists #63785.Interruption is unchanged. Escape on the parent does not cancel children. A child stopped with
composer.subagent.interruptbecomescancelled, sooutstandingdrops it and the reminder goes away.If you prefer restoring foreground calls (#64073) or a
job_waittool (#60497), part 1 still applies to background calls.Do you agree with part 1 as a first, small PR? If so, please assign this issue to me. I will include a regression test built on
subagent-idle-e2e.test.ts.