GeezerVison is showing github.com — feat(core): always run subagents in the background by jlongster · Pull Request #63210 · anomalyco/opencode
Conversation
jlongster
commented
Nov 10, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Subagents always run in the background now. The subagent tool's background option is gone: every call returns a sessionID immediately, and the parent receives a <subagent> message each time the child goes idle.
Stacked on #63209 (report subagent results on every idle), which makes background reporting reliable across multi-turn and shell-woken work. Replaces the default flip from #62035, without its metadata-based foreground claim.
❌ Before
- Foreground by default: the parent blocks until the child finishes. Parallel work is opt-in with
background: true.
- A foreground follow-up to a running background child returns "still running" anyway; feat(core): run subagents in the background by default #62035 worked around that by writing
subagent.notify = false to the database, which leaves the child muted after a normal wait or a crash.
✅ After
- One mode:
subagents.start(recovery, { background: true }) and return the running handle. No jobs.block, no inline answers, no Ctrl+B handoff for subagents.
- A follow-up to a running child joins its current run; a follow-up to an idle child starts a new background job. Results always arrive as reports.
- Pressing Escape on the parent no longer cancels its running children; they keep going and report later. Per-child stop (
composer.subagent.interrupt) stays.
- Ctrl+B /
Session.background / jobs.backgroundAll stay for foreground shells.
- subagent({ background?: boolean }) // default: block and return the answer inline
+ subagent({ ... }) // always: return sessionID now, <subagent> report on every idle
🖥️ UI: subagent "Background" badges, the (background) subtitle, and the subagent ctrl+b background hint/footer item are removed from the TUI, app, session-ui and mini footer; blocking work is shells only. Docs (tools.mdx, agents.mdx, GUI plugin docs) describe the idle-report model.
🧰 opencode run: already waits for running jobs, pending inbox items and owned executions. Now every run that uses a subagent prints "waiting for N background job(s)", and the report-triggered parent turn decides the exit code. New test covers it.
🚩 Flag: none. We're shipping this as the new behavior.
📊 Proof
- Typecheck clean: core, server, tui, app, session-ui, cli.
packages/core full suite: 7007 pass, 354 skip, 3 fail (environmental only).
- tui mini footer/stream: 156 pass. app
session-background browser test: 5 pass. session-ui run-machine: 7 pass. cli noninteractive: 23 pass.
- App e2e specs
subagent-child-navigation and timeline-stream were updated and typechecked; they need the full Playwright fixture, so CI runs them.
👀 Read: packages/core/src/tool/plugin/subagent.ts (mostly deletion), packages/app/src/session/requests/background.ts, packages/tui/src/mini/footer.view.tsx.
Visual
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" stroke="currentColor">
<style>
.c{animation:f 3.6s ease-out infinite}
.c2{animation-delay:.25s}.c3{animation-delay:.5s}
@keyframes f{0%{opacity:0;transform:translateX(-24px)}15%,80%{opacity:1;transform:translateX(0)}100%{opacity:0;transform:translateX(0)}}
.r{animation:r 3.6s linear infinite}
@keyframes r{0%,100%{opacity:.35}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){.c,.r{animation:none}}
</style>
<rect x="8" y="22" width="60" height="28" rx="6" stroke-width="1.5"/>
<text x="38" y="40" fill="currentColor" stroke="none" font-size="10" text-anchor="middle" font-family="sans-serif">parent</text>
<rect class="r" x="74" y="31" width="24" height="10" rx="5" fill="currentColor" fill-opacity=".25" stroke="none"/>
<g class="c"><rect x="132" y="6" width="96" height="16" rx="4" stroke-opacity=".7"/><text x="180" y="18" fill="currentColor" stroke="none" font-size="9" text-anchor="middle" font-family="sans-serif">subagent · running</text></g>
<g class="c c2"><rect x="132" y="28" width="96" height="16" rx="4" stroke-opacity=".7"/><text x="180" y="40" fill="currentColor" stroke="none" font-size="9" text-anchor="middle" font-family="sans-serif">subagent · running</text></g>
<g class="c c3"><rect x="132" y="50" width="96" height="16" rx="4" stroke-opacity=".7"/><text x="180" y="62" fill="currentColor" stroke="none" font-size="9" text-anchor="middle" font-family="sans-serif">subagent · running</text></g>
</svg>
Added by the opencode bot (AI-generated).
Related: #55760, #36423, #44748
Public API: removes the subagent tool's background input; its output status is always running and no completed answer is returned inline (breaking for prompts or plugins that expected inline results)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't run this live: with the simulated model, the scripted subagent call never executed on either checkout. The changed core, TUI, CLI and session-ui tests pass, and the core type check (tsc -b) is clean. The one-mode design reads well, and the ACP note below is the main concern.
Public API: the subagent tool contract changes in ways that break existing callers.
- Input
background is removed. Stray values are ignored when the input is decoded, but the advertised JSON Schema sets additionalProperties: false.
- Output
status goes from "completed" | "running" to always "running".
- The tool result no longer includes an inline
<subagent state="completed"> answer.
- Pressing Escape on the parent no longer cancels its running children.
- In the mini TUI, the subagent
session.background keybinding layer is removed.
Agent prompts or plugins that depended on getting the answer inline will now get it only through <subagent> reports. HTTP, SDK and config are unchanged.
Concerns:
- ACP: #55760 reports that the parent turn started by a background subagent report sends nothing to ACP clients after
end_turn. Background used to be opt-in. Now every subagent result would be lost for ACP users. Please check how this interacts with packages/cli/src/acp.
- The
notify=false path no longer makes sense (inline).
- A dead foreground branch is left in
SubagentJob.start (inline).
Related: #55760, #36423, #44748
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
"Background mode (background=true) launches it asynchronously and returns immediately; you are notified when it finishes.",
|
|
|
"Use background only for independent work that can run while you continue elsewhere.",
|
|
|
"Pass the returned sessionID to continue that specific child conversation. A follow-up to a running child joins its current run.",
|
|
|
"Pass notify=false for a new subagent to stop receiving its idle reports.",
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With foreground gone, notify=false leaves the parent with no way to get the child's result. The backgroundResult text for notify=false still says "To check on it, call the subagent tool with this sessionID". That call now sends the child another prompt and returns running straight away, so it can't be used to check on it. It also wakes a child that may already be idle. Either drop notify for the subagent tool, or change that message to point at a way of reading the child session that doesn't prompt it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded in e8351f5. The silent launch now says the result won't come back, to use notify=false only when the result isn't needed, and that calling subagent with the sessionID sends more work. The tool description's notify line says the same.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
opencodejr[bot] reacted with eyes emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That fixes it. I checked e8351f5fb7 on pr/head:
- Launch text (
subagent.ts:29): the notify=false result no longer says calling subagent with the sessionID will "check on it". It now says the result won't come back and that a call with the sessionID sends more work. That matches what the code does: a follow-up prompts the child and returns running.
- Tool description (
subagent.ts:63): it now says to use notify=false only when the results aren't needed. With no foreground mode left, that's the only honest way to describe it.
- Test: the assertion in
tool-subagent.test.ts:1003 was updated to the new string. I read it but didn't run it.
The model still has one way back if it changes its mind: a follow-up with notify: true turns reporting back on for that child. An explicit value is written at subagent.ts:176-178, and line 207 then reports according to that setting. Neither the launch text nor the description mentions this. It's optional and doesn't need to block the PR.
I didn't change anything in repo/. The bun.lock modification in the working tree isn't mine and I left it alone.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
),
|
|
|
),
|
|
|
)
|
|
|
if (options?.background) return yield* resume.pipe(Effect.as(""))
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All callers now pass { background: true }: the subagent tool, config/plugin/command.ts and restart recovery. So the non-background branch below this line can no longer run: the startedSeq lookup, lastAssistantAfter and formatBody. The same goes for the StartOptions.background flag and the Bus and Database dependencies it needs. Could start always background and drop the option, so the job layer doesn't keep a second result path that nothing uses?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in the stacked follow-up #63223: SubagentJob.start always runs in the background, and StartOptions, the inline lookup, SubagentJob.outstanding and SessionExecution.periodStartSeq are all gone. It's a separate PR so this one stays focused on the behavior change.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
opencodejr[bot] reacted with eyes emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. #63223 covers what I raised: start always runs in the background, and the PR drops StartOptions, the inline-answer path, SubagentJob.outstanding, SessionExecution.periodStartSeq, and the unused SessionStore/Database dependencies. Keeping that cleanup in its own PR is fine, since the dead branch does nothing in this one. Nothing more needed in this thread.
I've only read #63223's description; I haven't checked its diff or run its tests.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
User decisions:
- Remove the subagent tool's background option so subagents always run in the background
- Land this as its own PR after report-on-idle
- Escape on the parent leaves its running children going; they report later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new push only rebases this commit onto dev now that #63209 is merged. The one real difference is the conflict fix in message-timeline.tsx, which looks right. I reran the core subagent, TUI mini and session-ui run-machine tests, and the core and app type checks: all clean.
The two earlier points are not addressed yet:
- the misleading
notify=false hint
- the unused foreground branch in
SubagentJob.start
The ACP concern (#55760) still applies. The public API impact is the same as before.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
User decisions:
- Reword the notify=false launch text instead of removing notify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new commit fixes the notify=false point. The launch text and tool description now say plainly that a silent subagent's result won't come back, and no longer tell the model to check on the child through the tool. The test update matches, and tool-subagent.test.ts passes. The unused foreground branch in SubagentJob.start is still open, and nothing new comes up. The public API impact is unchanged from my last review.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Reopened as #63382 (same change, rebased on dev) to get a fresh CI run.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Hona
Awaiting requested review from Hona
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|