Skip to content

fix(opencode): execute subtask tool calls in parallel#14196

Open
gareys wants to merge 1 commit intoanomalyco:devfrom
gareys:fix/parallel-subtask-execution
Open

fix(opencode): execute subtask tool calls in parallel#14196
gareys wants to merge 1 commit intoanomalyco:devfrom
gareys:fix/parallel-subtask-execution

Conversation

@gareys
Copy link

@gareys gareys commented Feb 18, 2026

What does this PR do?

Fixes #14195. When an LLM response contains multiple Task tool calls (subtasks), the session loop previously popped one at a time and awaited each sequentially. This change collects all subtask parts from a response and runs them via Promise.all when there are multiple. Single subtasks still run directly. Compaction tasks are unaffected (they use a separate code path).

The core change is in packages/opencode/src/session/prompt.ts: subtask execution is extracted into an async function, and the loop branches on subtasks.length > 1 to decide between sequential and parallel execution.

How did you verify your code works?

  1. Built a patched binary via ./packages/opencode/script/build.ts --single
  2. Ran an orchestrator agent that dispatches 3 Task tool calls (to 3 different subagent types) in one response
  3. Confirmed all 3 subagents spawn and execute concurrently instead of one-at-a-time
  4. Verified single-subtask responses still work normally
  5. Typecheck passes (bun turbo typecheck — all 12 packages)

When an LLM response contains multiple Task tool calls, they are now
executed concurrently via Promise.all instead of sequentially. Single
subtasks still run directly with no overhead. Compaction tasks are
unaffected.
@rekram1-node
Copy link
Collaborator

left comment on issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Task tool calls in a single LLM response execute sequentially instead of in parallel

2 participants

Comments