Description
When I ask the model to run multiple independent tasks in parallel, I only ever see one subagent running at a time. Each one finishes before the next starts, even though they should be independent and could run concurrently.
This is a re-report of #14195 (closed due to inactivity) — the bug is still present.
I poked around the code a bit. The session loop in src/session/prompt.ts around line 1734 does tasks.pop() then calls handleSubtask which blocks until the subagent finishes — so it naturally processes one at a time. Seems like it should collect all subtasks from tasks and run them with Effect.forEach(..., { concurrency: "unbounded" }) instead. Something like:
const subtasks = tasks.filter(t => t.type === "subtask")
const remaining = tasks.filter(t => t.type !== "subtask")
if (subtasks.length > 0) {
yield* Effect.forEach(subtasks, (task) =>
handleSubtask({ task, model, lastUser, sessionID, session, msgs })
, { concurrency: "unbounded" })
continue
}
Each handleSubtask call has its own local state (assistantMessage, part, summaryUserMsg) so they shouldn't step on each other.
There's also a minor thing — the background param on the task tool is hidden from the LLM behind an experimentalBackgroundSubagents flag (task.ts:332), so even if the model wanted to dispatch non-blocking tasks it can't. Might be worth exposing that or at least defaulting it on.
Plugins
None
OpenCode version
v1.15.11
Steps to reproduce
- Start an opencode session with a model that supports parallel tool calls
- Ask a task that the LLM will decompose into 2+ independent subtasks (e.g. "Implement these 3 features in parallel: A, B, and C")
- Observe the subagent dispatch — only 1 subagent runs at a time, each completing before the next starts
- Expected: all subagents start concurrently and run in parallel
Screenshot and/or share link
N/A
Operating System
Linux (Ubuntu 22.04)
Terminal
Alacritty
Description
When I ask the model to run multiple independent tasks in parallel, I only ever see one subagent running at a time. Each one finishes before the next starts, even though they should be independent and could run concurrently.
This is a re-report of #14195 (closed due to inactivity) — the bug is still present.
I poked around the code a bit. The session loop in
src/session/prompt.tsaround line 1734 doestasks.pop()then callshandleSubtaskwhich blocks until the subagent finishes — so it naturally processes one at a time. Seems like it should collect all subtasks fromtasksand run them withEffect.forEach(..., { concurrency: "unbounded" })instead. Something like:Each
handleSubtaskcall has its own local state (assistantMessage, part, summaryUserMsg) so they shouldn't step on each other.There's also a minor thing — the
backgroundparam on the task tool is hidden from the LLM behind anexperimentalBackgroundSubagentsflag (task.ts:332), so even if the model wanted to dispatch non-blocking tasks it can't. Might be worth exposing that or at least defaulting it on.Plugins
None
OpenCode version
v1.15.11
Steps to reproduce
Screenshot and/or share link
N/A
Operating System
Linux (Ubuntu 22.04)
Terminal
Alacritty