Skip to content

fix(task): propagate subagent provider errors to orchestrator#18509

Closed
Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Haohao-end:fix/5204-subagent-provider-error-propagation
Closed

fix(task): propagate subagent provider errors to orchestrator#18509
Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Haohao-end:fix/5204-subagent-provider-error-propagation

Conversation

@Haohao-end
Copy link

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

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 21, 2026
@github-actions
Copy link
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

#18444 - fix(tui): surface sub-agent provider errors in parent task flow

  • Directly related: This PR appears to address the same issue of surfacing subagent provider errors to the parent, but from a TUI perspective. This might be a duplicate or closely related fix addressing the same root cause.

#17577 - feat(opencode): add model override for task tool subagents

  • Related feature: While this is a feature rather than a fix, it involves task tool subagent handling and might have context on the error propagation mechanism.

#13321 - fix: robust subagent completion propagation

  • Historical context: This older PR also dealt with subagent result propagation issues and may be relevant for understanding the context.

I recommend reviewing #18444 most closely as it appears to be addressing the same issue from a different angle.

@Haohao-end
Copy link
Author

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

@github-actions
Copy link
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 21, 2026
@github-actions github-actions bot closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant