Skip to content

[Bug]: OpenCode: a resumed background subagent's report settles an older call, leaving the newest one running forever #26319

Open

Description

@nkoynov

Before submitting

  • 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

  1. In an OpenCode 2 thread, start a background subagent and resume it several times (the subagent tool called again with the same sessionID). Each call gets its own subagent item in T3.
  2. Have one of those runs' reports not reach T3 (or reach it out of order).
  3. Keep resuming the child.

Expected behavior

A report settles the call it answers. If OpenCode's report can't name the call, the newest open call for that child is the one running; older open calls for the same child have necessarily ended (a child runs one job at a time) and can be settled too.

Actual behavior

T3 attaches each report to the first call in state.calls whose child is the reporting session (onReport in packages/provider-opencode/src/server/v2/adapter.ts), not to the call that started that run:

const call = [...state.calls.values()].find(
  (candidate) => candidate.child?.sessionId === childId,
);

As long as every report arrives, the oldest open call is also the right one. Once one is missed, everything shifts by one: each later report closes an older call with the newer report's text, and the newest call stays "running" with no way to settle.

Seen on 0.1.3-nightly.20261026.3710 with OpenCode 2.1.4: one child resumed about 40 times in a day. From some point on six calls stayed running although OpenCode delivered all five of their reports; a call started at 21:20 holds the report text of a call started at 03:25; one report closed four calls at once. Two other threads each have one call stuck the same way, with the child session idle in OpenCode for hours. The stuck items keep the parent's Lineage cards "Running", and anything that asks T3 whether a thread is busy treats it as busy indefinitely. Still the same code on main 658c9da.


Model and harness: Claude Opus 5.5 in OpenCode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions