You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: OpenCode subagent whose own work is still running counts as finished #40644
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
T3 0.1.12-nightly.20261121.5024 (Linux server), an OpenCode 2.3.2 thread.
Have the agent start a background subagent that itself starts a background subagent (for example one that runs sleep 40), and then ends its turn.
Watch the parent thread while the grandchild runs.
Expected behavior
The child stays listed as running background work until its own work is done, and the thread doesn't announce it finished while it is still working.
Actual behavior
When the child goes idle while its own background work still runs, OpenCode reports to the parent right away, and again each time that work wakes it (anomalyco/opencode#63209, anomalyco/opencode#63675, anomalyco/opencode#64026). Such a report says so only in its text tag, <subagent sessionID="…" state="running" …>, followed by a "Background work still running:" list. Its metadata keeps state: "completed".
The OpenCode 2 adapter reads only the metadata (reportOutcome(stringField(payload.metadata, "state")) in onReport), so it settles the call as completed and drops the child from pendingBackgroundTasks. While the child keeps working, the parent looks finished: the wake run for the running report ends after a second or two with nothing listed, and the desktop app announces "Thread completed". That repeats for every further running report until the child's last one, and the subagent card shows the child as done while it still runs.
Impact
Minor bug or occasional failure
Version or commit
v0.1.12-nightly.20261121.5024; the adapter code is the same on main (db9efc5)
Environment
NixOS x86_64, T3 server as a user service, OpenCode 2.3.2 (opencode serve managed by T3), Cursor models through an OpenCode provider plugin
Logs or stack traces
OpenCode database, 2026-11-19 to 2026-11-22 00:33 UTC:
31 subagent reports tagged state="running", all 31 with metadata.state "completed"
One thread (child ran three review rounds through its own background subagent):
08:56:36 UTC first running report -> call settled as completed
three more running reports, each a ~2 s parent run
thread shown completed 08:58:37-09:00:15 and 09:01:08-09:02:46 while the child worked
7 days of top-level OpenCode threads: 91 parent runs started by such a report,
66 ended with nothing held (~9 false"Thread completed" alerts a day)
Workaround
A local patch that keeps the call pending while the report is tagged running (the same change as the PR I'll link).
Activity