Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): show OpenCode subagents in the Agents panel #10858

Closedjmfrank63(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/10858/headopened View on GitHub

Refs #5952

The problem

The Agents panel is built exclusively from task.* activities, but OpenCodeAdapter never emitted any. It classified a subagent invocation as an ordinary tool call (collab_agent_tool_call), so the roster stayed empty on every OpenCode thread even while subagents were running. Codex, Claude, and Antigravity all translate their native subagent signals into task lifecycle events; OpenCode was the only enabled adapter that did not.

The fix

Translate collab_agent_tool_call tool parts into task.started / task.updated / task.completed with timelineBypass, instead of emitting a timeline tool row.

  • Lifecycle — first non-terminal update becomes task.started, later updates become task.updated, and completed/error become task.completed with status completed/failed.
  • One row per subagent — OpenCode repeats a part on every streamed update, which produced three task.started events for a single subagent and would have tripled the roster count. A per-session set of started call ids keeps it to one.
  • Identity — role from subagent_type, description from description, title from the resolved state.title. No agentId is set, so classifyTaskAgentKind stamps these agentKind: "agent" and they land in the roster rather than the background bucket.
  • No lost output — the completed row carries the subagent's result in summary, reusing the existing detailFromToolPart. That is the same text the tool row previously shipped as detail, so payload size is unchanged and moving the subagent off the timeline drops nothing.

timelineBypass keeps the parent timeline to a single spawn CTA rather than a raw tool row, matching how Codex reports child agents.

No contract change: every field used already existed as optional task linkage. No client change: web and mobile both consume the same task.* events.

Before / after

Before (upstream/main)After (this PR)
before-agents-panelafter-agents-panel
Agents panel reads "No agents yet", and the subagent shows inline in the timeline as a raw task tool row.Agents panel lists the subagent under DIRECT SPAWNS with its role (explore), duration, and result. The timeline collapses to a single "Ran 1 subagent" CTA.

Both captures use the same prompt, project, and model (OpenCode GLM-5.3 via ClinePass) against OpenCode 1.18.29; only the server code differs.

Testing

Three tests in OpenCodeAdapter.test.ts, each watched failing before the fix: roster routing with no timeline leakage, one task.started per subagent across repeated updates, and result/failure text on the completed row.

vp test run apps/server/src/provider/Layers/OpenCodeAdapter.test.ts \
            apps/server/src/provider/Layers/OpenCodeProvider.test.ts \
            apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts \
            apps/web/src/session-logic.test.ts
# 273 passed

vp run --filter t3 typecheck   # clean
vp lint <changed files>        # clean

Also verified end to end in a local vp run dev instance against OpenCode 1.18.29: the subagent now appears in the Agents panel.


Written by Claude Opus 5 (1M context) in Claude Code, driven through T3 Code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved handling of subagent tasks during OpenCode sessions.
    • Task progress now appears with clear started, updated, and completed statuses.
    • Completed and failed tasks display the subagent’s result or error details.
  • Bug Fixes

    • Prevented duplicate task-start notifications when repeated progress updates are received.
    1. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

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

    3. Approvability

      Verdict: Approved at eb5e729

      Macroscope's review found this PR approvable — This is a focused server-side event-mapping fix that exposes already-running OpenCode subagents through the existing Agents surface without changing execution, schemas, or configuration. The adapter change is isolated and covered by targeted tests for lifecycle routing, deduplication, and results.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review Change StackReview Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: d9c863d2-f2be-4356-92a6-538bd2f3ffaf

      📥 Commits

      Reviewing files that changed from the base of the PR and between 20e2e899ecded6b30e12fa23c8f18847c2bf12e1 and eb5e72935303ad9771a8ab2ba80664069a0c5be7.

      📒 Files selected for processing (2)
      • apps/server/src/provider/Layers/OpenCodeAdapter.test.ts
      • apps/server/src/provider/Layers/OpenCodeAdapter.ts

      Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      OpenCode task tool events now map to runtime subagent task lifecycle events. The adapter deduplicates repeated start events and includes result or error output in completed task payloads. Tests cover routing, lifecycle transitions, and task outcomes.

      Changes

      OpenCode subagent task events

      Layer / File(s)Summary
      Subagent task lifecycle mapping
      apps/server/src/provider/Layers/OpenCodeAdapter.ts
      The adapter tracks started subagent task IDs and maps collab_agent_tool_call updates to task.started, task.updated, and task.completed events. Completed and failed tasks clear their tracked IDs and include task metadata and output.
      Task lifecycle validation
      apps/server/src/provider/Layers/OpenCodeAdapter.test.ts
      Tests verify task event routing, suppression of duplicate task.started events, and completed or failed summaries and statuses.

      Priority: ➖ Normal

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Severity of issue fixed: Medium

      Merge Risk: ⚪ Minimal · up to 8aa9d

      OpenCode subagent tool calls now populate the Agents panel with running and final status while avoiding duplicate entries and raw timeline rows. The covered lifecycle behavior is ready to merge.

      Suggested reviewers: t3dotgg, maria-rcks, juliusmarminge

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedThe changes satisfy issue [#10857] by converting OpenCode subagent tool parts into task lifecycle events, preventing duplicate starts, preserving subagent metadata and results, and routing the entries…
      Out of Scope Changes check✅ PassedThe changes are limited to OpenCode adapter behavior and focused tests. They directly support the linked issue and do not introduce unrelated product or client changes.
      Title check✅ PassedThe title clearly and concisely describes the main change: displaying OpenCode subagents in the Agents panel.
      Description check✅ PassedThe description explains the problem, fix, behavior, testing, and UI impact. It includes before-and-after screenshots and sufficient implementation context, although it does not use the template's exa…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Comment `@coderabbitai help` to get the list of available commands.
    5. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    6. Would love to see this merged! 🙏

      OpenCode is my primary harness, which I use alongside Codex through T3 Code, so being able to watch OpenCode subagents at work would be really useful. Thanks for working on this!

    7. Thanks for the PR. We're not taking changes to the orchestration and provider layers right now: that part of the server is being rewritten for V2, and merging into the current code would either conflict with or be thrown away by that work.

      Closing for now. If this is still an issue once V2 lands, please reopen (or open a fresh PR against the new code) and we'll take a proper look.

    8. juliusmarminge closed this

Sign in to join this conversation.