Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): show opencode subagents in the Agents panel #9295

ClosedMina-Sayed(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/9295/headopened View on GitHub

Problem

Threads driven by the opencode provider never show anything in the sidebar Agents panel: it stays on No agents yet while real subagents run and complete. Reproduced live on a dev server — a task-tool subagent built files and finished, panel stayed empty (user-confirmed).

Root cause: OpenCodeAdapter reports a subagent only as generic item.started/updated/completed rows (itemType: collab_agent_tool_call) and never emits task.* runtime events. The Agents surface folds task.* activities only (foldSubagentActivities), so opencode subagents are invisible, unlike Claude/Codex which emit task.started/progress/completed.

Fix

apps/server/src/provider/Layers/OpenCodeAdapter.ts: re-emit the task-tool part lifecycle (pending/running/completed|error) as task.started/progress/completed, keyed by the tool call id, with description/role carried from the launch input (which arrives after the pending part). The existing item.* tool row is unchanged; ingestion and the client fold needed no changes.

After the fix, the same repro persists task.started/progress/completed and the panel shows the agent row (DIRECT SPAWNS with role chip, elapsed time, result summary, settled count, plus the Ran 1 subagent CTA in chat).

Verification

  • vp test run apps/server/src/provider/Layers/OpenCodeAdapter.test.ts — all pass (incl. 2 new: input parsing/result-unwrap unit test + task-lifecycle integration test with a non-task-tool control)
  • tsgo --noEmit -p apps/server — 0 errors
  • vp lint on both touched files — clean
  • Branch rebased onto latest upstream main before opening; fork main synced.

Built with Muse Spark (opencode harness).


Note

Medium Risk Changes event emission in the OpenCode provider path (turn abort and part updates); behavior is covered by new tests but affects how the UI sees subagent state.

Overview OpenCode task tool parts are now mirrored as task.started, task.progress, and task.completed runtime events so subagents appear in the Agents panel, which only folds task.* activities—not generic item.* tool rows.

The adapter tracks per–tool-call linkage (description, subagent_type role, idempotent task.started, and a settled flag). Helpers describeOpenCodeTaskToolInput and summarizeOpenCodeTaskToolOutput parse launch input and unwrap <task_result> XML from outputs. Turn interruption emits task.completed with status stopped for any unsettled in-flight task; late running parts after a terminal state are ignored so rows do not flip back to working.

Existing item.* emissions for the same tool are unchanged. Tests cover parsing, full lifecycle, interrupt settlement, and the late-part guard.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8c0ad497f6acf8225abac428d9f23d84123dfccf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The PR adds production-side lifecycle translation and interruption state handling for OpenCode tasks, changing persisted runtime events and Agents-panel behavior on an existing path. Although it is focused and well-tested, the stateful asynchronous behavior is substantial enough to warrant human review.

      Not approved because:

      • Monthly spending limit reached (workspace setting). Approvability relies on correctness review in order to determine eligibility
      Review your spending limits in [Billing settings](https://app.macroscope.com/pingdotgg/settings/billing). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Update: the interruption case flagged by Cursor Bugbot and Macroscope is now fixed (9a3ec7a) — Stop settles in-flight opencode subagents via task.completed/stopped, mirroring Claude's teardown sweep, with an integration test. The single review thread is replied to and resolved. Re-review welcome.

    5. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9a3ec7a21e11df967fd0a7f91a091d645c8548b5. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. Follow-up to the updated approbability note (race reactivating a stopped task): fixed in ecff490. The running branch is now guarded on the same settled flag, with a regression test proven to fail without the guard and pass with it. Details + verification in the resolved review thread. Both review threads on this PR are now resolved; re-review welcome.

    7. Note

      🤖 GPT-6 Astra (preview) responding on behalf of Theo

      This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

      Closing this alternative in favor of #7393, which tracks child-session identity and background completion for native OpenCode subagents. Review continues there. This PR's Stop sweep and late-running-event tests are recorded on that PR for follow-up, so closing this duplicate does not mark #5952 fixed.

Sign in to join this conversation.