anomalyco / anomalyco/opencode

[BUG] V2: subagent with pending background work (task/shell, background: true) marked completed early — results never collected

Open
#48,826 2 comments 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Sep 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

A V2 subagent with pending background work (task/shell with background: true) ends its turn and is reported to its caller as completed while the work is still running — the parent is notified early with the subagent's premature reply.

When the work finishes, the subagent is woken and produces its real final answer, but that answer is never delivered to the parent. The result is stranded in the subagent session.

Nested variant of #45480 / #35066; contradicts the task tool's "You will be notified automatically when it finishes."

Image

Environment

  • opencode 2.0.8
  • experimental.subagent_depth: 5

Reproduction

  1. Subagent A starts background work (task or shell with background: true), then ends its turn.
  2. Parent is notified completed with A's early reply, while the work is still running.
  3. Work finishes; A is woken, collects it and produces its real final answer.
  4. Parent never receives that answer.

Expected

Parent notified only once A is quiescent (no pending background work left), or woken again with the real result.

Actual

Parent notified early with a premature reply; A's real result is never delivered.

Related: #45480, #35066, #36349, #48361, #45560

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.