Skip to content

BUG: task-tool subagents exit completed with empty results on empty provider completions (finish: unknown, 0 tokens) #236

Description

@aarontrowbridge

Summary

Subagent tasks dispatched via the task tool exit as completed with an empty task_result when the provider returns an empty completion (0 input/output tokens, cost 0, finish reason unknown). The parent cannot distinguish "subagent finished with nothing" from "every model call failed."

Over the last 3 days on the canonical server: ~130 such empty completions across every agent class (parent sessions, subagents, compaction), 12 task-tool parts in error state, 24 task parts stuck at running (zombies from interrupted sessions).

Context

  • Engine: fork build merge-upstream-2026-08-16 (server binary; extension pin v1.18.10-amicode.4)
  • OS: Darwin 24.6.0 arm64
  • Provider path: opencode-go (glm-5.3) via the shared gateway
  • Discovered while diagnosing recurring "subagents dying" reports in autoresearch campaigns — the campaign ledger's "instant completion, zero artifacts" experimenter failures are this bug.

Expected vs actual

Expected: an empty provider completion (0 tokens, finish unknown) is a transport/endpoint error — the loop should retry with backoff or surface an error; a subagent must never exit completed on one.

Actual: assistant messages record tokens {in:0, out:0}, cost 0, finish "unknown" (up to ~84s elapsed per call); the subagent retries a few turns, then exits completed with an empty result.

Sibling error states observed in the same window: Task cancelled / Tool execution aborted (parent interruption), and Unknown agent type: … (agent-set drift — a separate class).

Diagnostics
  • Empty-completion counts by agent class, 2026-08-21→23: general 57, build 25, autoresearch 20, experimenter 18, implementer 6, plan 3, hypothesizer 2, compaction 1
  • Scrubbed message signature: {"role":"assistant","cost":0,"tokens":{"input":0,"output":0},"modelID":"glm-5.3","providerID":"opencode-go","finish":"unknown"}
  • Task-tool parts in window: 264 completed / 12 error / 24 stuck at running
  • Example child session: 6 turns over 4 minutes, all assistant messages empty (0 tokens, finish unknown), exits completed with empty task_result
  • No absolute paths, no vault content

intake: not-ready — mature per the maturity contract before picking up
suggested_path: B
diagnostics: inline
upstream: anomalyco/opencode#41469 (open)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions