Skip to content

fix: parallel sub-agent failure propagates — one stuck sub-agent aborts all others #37315

Description

@zxkjack123

Description

When an agent dispatches multiple sub-agents in parallel via task(), and one sub-agent gets stuck or fails, the opencode runtime currently aborts ALL sub-agents — including those that completed successfully. This means that in a batch of 5 parallel sub-agent calls, if 4 succeed and 1 times out, the 4 successful results are lost.

Steps to reproduce

  1. Create an agent that dispatches 3+ sub-agents in parallel via task(subagent_type="...")
  2. Arrange for one sub-agent to get stuck (e.g., recursive exploration loop, unavailable tool)
  3. Wait for the stuck sub-agent to trigger a timeout/abort
  4. Observe that ALL sub-agents are terminated — even those that completed successfully

Evidence

From a production opencode deployment, session ses_0dab015c2:

  • FDR dispatched 5 sub-agents in parallel: 4 explore + 1 scientific-paper-research
  • 2 completed successfully (explore-2 returned findings, SPR returned paper data)
  • 3 got stuck (explore children in recursive exploration loops)
  • After 5.7 hours, the runtime aborted all 5 — even the 2 successful ones
  • Total loss: 176K tokens of completed work discarded

More broadly, 5 mass-abort events observed where 3+ sub-agents were terminated together:

  • ses_10049ce8: 4 children aborted (3 completed, 1 stuck)
  • ses_0d4228cd: 3 children aborted
  • ses_0dab015c2: 3 children aborted
  • etc.

Expected behavior

  1. Independent sub-agent lifecycle: Each sub-agent should have its own success/failure/timeout status. When the parent collects results, it should receive:

    • completed results from successful sub-agents
    • error + reason from failed sub-agents
    • timeout from timed-out sub-agents
  2. Partial results delivery: The parent agent should be able to proceed with partial results rather than losing everything when one sub-agent fails.

  3. Per-subagent error isolation: A failure in one sub-agent should not cascade to abort sibling sub-agents.

Impact

This is critical for multi-agent orchestrator patterns where parallel sub-agent delegation is the normal mode of operation. Currently, the reliability of parallel delegation is bounded by the worst-performing sub-agent, not the best.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions