Skip to content

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

Closed
jmfrank63 wants to merge 3 commits into
pingdotgg:mainfrom
jmfrank63:fix/opencode-subagent-agents-panel
Closed

jmfrank63 wants to merge 3 commits into
pingdotgg:mainfrom
jmfrank63:fix/opencode-subagent-agents-panel

Conversation

@jmfrank63

@jmfrank63 jmfrank63 commented Sep 8, 2026 •

Copy link
Copy Markdown

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-panel after-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.

The Agents panel is built from task.* activities, but the OpenCode adapter
classified subagent `task` tool calls as ordinary tool rows and never emitted
any task lifecycle events, so the roster stayed empty on every OpenCode thread
even though subagents were running.

Translate `collab_agent_tool_call` tool parts into task.started/task.updated/
task.completed with timelineBypass, matching the Codex, Claude, and Antigravity
adapters. A per-session set keeps exactly one task.started per subagent because
OpenCode repeats the part on every streamed update, and the completed row
carries the subagent's result so moving it off the timeline drops nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

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 20e2e89 and eb5e729.

📒 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 name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring 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 name Status Explanation
Linked Issues check ✅ Passed The 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 ✅ Passed The 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 ✅ Passed The title clearly and concisely describes the main change: displaying OpenCode subagents in the Agents panel.
Description check ✅ Passed The 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.

@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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.

@j-gaertig

Copy link
Copy Markdown

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!

@juliusmarminge

Copy link
Copy Markdown
Member

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.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants