#18509 · @Haohao-end · opened Mar 21, 2026 at 9:36 AM UTC · last updated Mar 21, 2026 at 9:51 AM UTC
fix(task): propagate subagent provider errors to orchestrator
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
Subagent provider errors were not propagating to the orchestrator, causing it to spin indefinitely. This PR fixes the issue by explicitly checking for and throwing errors from child sessions. New focused regression tests are included.
Description
Problem
Provider/model failures inside subagent sessions were not reaching the primary orchestrator, so the parent could continue spinning instead of surfacing the real error.
Root cause
TaskTool.execute() treated the child session result as a successful assistant text response and ignored childAssistant.info.error, which downgraded provider failures into empty task results.
Fix
After SessionPrompt.prompt(...) returns, TaskTool.execute() now checks for info.error and throws a normal Error with the child error message. Successful child responses still follow the existing task_id + <task_result> path unchanged.
Validation
- Added focused regression tests for successful subagent output propagation
- Added focused regression tests for provider-error propagation from subagent to parent
- Verified with:
bun test test/tool/task.test.ts
Linked Issues
None.
Comments
PR comments
Haohao-end
CI is currently failing on unrelated existing typecheck errors in packages/app:
- src/components/dialog-connect-provider.tsx:386
- src/components/dialog-custom-provider.tsx:134
My change only touches:
- packages/opencode/src/tool/task.ts
- packages/opencode/test/tool/task.test.ts
Local validation for this fix:
- bun test test/tool/task.test.ts
Changed Files
packages/opencode/src/tool/task.ts
+7−0packages/opencode/test/tool/task.test.ts
+177−1