altimate-code
altimate-code copied to clipboard
Background subagents never run in the background, even with OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
What happens
Setting OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true does not make subagents run in the background. Every task call still blocks the parent agent until the subagent finishes.
packages/opencode/src/tool/task.tsthrowsBackground subagents require OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=trueon anybackground: truecall, without checking the flag. With the flag set, the call still fails with an error telling you to set the flag.- The flag is read only in
tool/registry.ts, where it decides whether the task schema keeps thebackgroundfield. The task tool's own JSON schema already removes that field, so models never see it, flag or not. - The background tests in
test/tool/task.test.tsare skipped.
Why it matters
The parent cannot do anything else while a subagent runs, and the request after each wait starts from a cold prompt cache. In a four-run headless evaluation, the parent spent 79 minutes in total blocked on subagents, and the requests after those waits were cache misses worth about 716K tokens.
Expected
With the flag on, task with background: true returns at once with a task_id, and a later task call with that task_id waits for the subagent and returns its result. With the flag off, the current error stays.