t3code icon indicating copy to clipboard operation
t3code copied to clipboard

OpenCode provider: subagents spawned via delegation never appear in the Agents pane (no task.* events)

Open gustavocaiano opened this issue 2 months ago • 2 comments

What happened

When using T3 Code with an OpenCode-based thread, subagents spawned via delegation (the native task/subagent tool) never appear in the Agents pane. They only show up as a "Subagent task" row in the chat timeline. In contrast, Claude Code and Codex threads show live subagent entries in the Agents pane.

Why

The Agents pane is built purely from runtime task.started / task.progress / task.completed events bearing parentAgentId/task linkage:

  • Claude adapter: emits task_started/task_progress/task_notification system messages → task.* events ✅
  • Codex adapter: collabAgent/* notifications → mapCollabAgentEvent → task.* events ✅
  • Antigravity (ACP) adapter: promotes ToolCallUpdated to subagent task.* events ✅
  • OpenCode adapter: has no equivalent path ❌. In message.part.updated handling, tool parts are classified by toToolLifecycleItemType() into collab_agent_tool_call chat items only. Child opencode sessions (session.created with parentID) are tracked just for permission/question routing (relatedSessionIds), never promoted to task.* events.

All the data needed is already available at the emit site: part.state.metadata.sessionId (child session), part.state.input.subagent_type (agent name), part.state.input.description, part.callID — and the tool-part handler shares the same closure as the adapter's runtime emit.

Suggested fix

In the OpenCode adapter's tool-part handler, when the tool is a delegation tool (task/subagent) and part.state.metadata.sessionId exists, emit alongside the item event (deduped per callID):

  • task.started once: { taskId: sessionId, taskType: "subagent", title: input.description ?? state.title, role: input.subagent_type, toolUseId: callID, model? }
  • task.progress on running updates: { taskId, description }
  • task.completed on completed/error: { taskId, status: "completed" | "failed", summary }

The shared fold layer (runtimeEventToActivities / taskLinkageActivityFields) and the UI already render these correctly for any provider — no UI changes needed.

I have a working prototype patch against the 0.0.41-nightly.20260914 server bundle (OpenCode adapter, insertion right after const itemType = toToolLifecycleItemType(part.tool);) that restores full Agents-pane parity; happy to share or open a PR.

Environment

  • Version: 0.0.41-nightly.20260914.1687 (also verified absent in 0.0.41-nightly.20260915.1752)
  • Provider: OpenCode (with the oh-my-opencode-slim orchestration plugin, though the issue reproduces with native delegation too)

gustavocaiano avatar Sep 15 '26 13:09 gustavocaiano

Closing as a duplicate of #5952. Same report: OpenCode native Task/subagent child sessions never appear in the Agents panel because OpenCodeAdapter does not emit task.* activities (only collab_agent_tool_call chat items).

Track the remaining work in #5952 (open fix PRs: #7393, #10858).

juliusmarminge avatar Sep 15 '26 13:09 juliusmarminge

Duplicate of #5952.

juliusmarminge avatar Sep 15 '26 13:09 juliusmarminge