Skip to content

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

Description

@gareys

Description

When an LLM generates multiple Task (subtask) tool calls in a single response, they execute one at a time instead of concurrently. In packages/opencode/src/session/prompt.ts, the session loop does tasks.pop() to grab a single subtask, awaits it, then continues the loop — so even 3 simultaneous Task calls run sequentially.

Regular tool calls already run in parallel via Promise.all in the batch/processor path, but subtask parts bypass that entirely.

Steps to reproduce

  1. Create an agent that dispatches 3 Task tool calls in one response (e.g. an orchestrator that sends work to 3 subagents)
  2. Observe that each subagent runs only after the previous one completes
  3. Expected: all 3 subagents run concurrently

OpenCode version

Latest dev branch (commit c6bd320)

Operating System

macOS 15.5 (darwin-arm64)

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions