Skip to content

Populate OpenCode skills and subagents breakdowns#557

Open
KevNev19 wants to merge 1 commit into
getagentseal:mainfrom
KevNev19:fix/opencode-skills-subagents
Open

Populate OpenCode skills and subagents breakdowns#557
KevNev19 wants to merge 1 commit into
getagentseal:mainfrom
KevNev19:fix/opencode-skills-subagents

Conversation

@KevNev19

Copy link
Copy Markdown

What

Populate the Skills & Agents breakdown for OpenCode sessions. Before this change the panel always showed "No skill/agent usage" for OpenCode, even when skills and subagents were used — while the Core Tools panel correctly counted the Skill and Agent tool invocations.

Fixes #556.

Root cause

buildAssistantCall (in src/providers/session-message.ts, shared by the OpenCode SQLite parser, the OpenCode file-based parser, and Kilo Code) built the tools list from tool parts but never read the name of the skill / subagent from the tool-call input. The resulting ParsedProviderCall carried no skills and no subagentTypes, so:

  • providerCallToTurn / providerCallToCachedCall hard-coded skills: [], so the classifier never set subCategory → empty skillBreakdown.
  • subagentTypes was undefined → empty subagentBreakdown.

In OpenCode's on-disk format the identifier lives in state.input:

// part file, skill tool
{ "type": "tool", "tool": "skill", "state": { "input": { "name": "commit" } } }
// part file, task (subagent) tool
{ "type": "tool", "tool": "task", "state": { "input": { "subagent_type": "explore", "description": "..." } } }

Change

  • ParsedProviderCall gains an optional skills?: string[] (mirrors the existing subagentTypes?).
  • buildAssistantCall extracts skills (from skill tool input.name) and subagentTypes (from task tool input.subagent_type) using .filter/.map (no bracket-assign, so the hot-path Semgrep rule is satisfied).
  • providerCallToTurn and providerCallToCachedCall pass call.skills ?? [] instead of [].

The downstream classifier subCategory gate (category === 'general') is intentionally left unchanged — it already has dedicated test coverage and is shared with the Claude path. This PR only fills the missing upstream extraction; subagents (no gate) always show, and skills show for general-category turns exactly as they do for Claude.

Tests

  • New fixture tests in tests/providers/opencode-file.test.ts: skill/subagent extraction from skill/task parts, and the empty case.
  • Full suite green: 1302 tests, 106 files.
  • npx tsc --noEmit clean; npm run build succeeds.

Verification on real data

Ran the built CLI against a real OpenCode file-store. Previously empty, now populated:

SKILLS:    pipeline-investigation, plan-spec, teams, mermaid, newrelic, splunk, jira, tdp-pipelines-report, confluence
SUBAGENTS: explore (189), general (14), general-purpose (2)

The Skills & Agents panel was always empty for OpenCode sessions even
when skills and subagents were used. buildAssistantCall (shared by the
OpenCode SQLite and file-based parsers, and Kilo Code) counted the
skill/task tool invocations but never read the skill name or subagent
type from the tool-call input, so the dedicated breakdowns had no names
to aggregate.

In OpenCode's part files the identifier lives in state.input: the skill
tool carries input.name and the task tool carries input.subagent_type.
Extract both in buildAssistantCall and surface them on
ParsedProviderCall.skills / .subagentTypes, then stop hard-coding
skills: [] in providerCallToTurn and providerCallToCachedCall so the
classifier's subCategory and the subagent breakdown receive the data.

Verified against real OpenCode data: the previously empty skills[] and
subagents[] now populate (pipeline-investigation, plan-spec, splunk, ...
and explore/general subagents).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode: skills[] and subagents[] report sections always empty (parser ignores skill/task tool input)

1 participant