anomalyco / anomalyco/opencode
Foreground subagent failure returns no task_id, so the parent cannot resume it
@kitlangton is already working on this.
Since Jul 27, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When a foreground subagent fails or is cancelled, the task tool reports a bare error string with no task id. The parent model has no handle to the child session, so it cannot resume it and whatever partial work the subagent did is stranded.
The branches inside the same function disagree about this. The success path and the background-error path both go through renderOutput, which emits <task id="...">. The two foreground branches in task.ts just do Effect.fail(new Error(result.error ?? "Task failed")) and Effect.fail(new Error("Task cancelled")).
#13910 reported this and was closed as completed, but it looks only partly covered — on current dev the foreground error and cancelled branches still return no id.
OpenCode version
1.18.7 (dev @ 55b0211690)
Steps to reproduce
- Get the agent to dispatch a foreground subagent through the task tool (no
background). - Make that subagent fail — cancel it, or let the provider return an error.
- The parent receives the error text with no
<task id="...">wrapper, so it has nothing to pass back astask_idto pick the session up again.
Operating System
macOS 26.5.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.