anomalyco / anomalyco/opencode

Foreground subagent failure returns no task_id, so the parent cannot resume it

Open
#39,196 6 comments 4 reactions 1 assignee View on GitHub

@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
  1. Get the agent to dispatch a foreground subagent through the task tool (no background).
  2. Make that subagent fail — cancel it, or let the provider return an error.
  3. The parent receives the error text with no <task id="..."> wrapper, so it has nothing to pass back as task_id to pick the session up again.
Operating System

macOS 26.5.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.