Skip to content

[Bug]: Subagents listed in opencode.json are incorrectly treated as primary agents (ignoring mode: subagent from agent files) #22130

@michaelvolz

Description

@michaelvolz

Description

When any subagent is added to opencode.json (even just to override the model for cost/performance reasons), OpenCode treats it as a primary agent.

The mode: subagent setting defined in the original agent .md files is completely ignored.

This causes all configured subagents to appear in the footer/Tab agent selector (making it unusable when using plugins like Compound Engineering that register many agents).

Plugins

No response

OpenCode version

1.3.17 (and all versions since v1.3.4)

Steps to reproduce

  1. Use any subagent (e.g. from Compound Engineering) that has mode: subagent in its .md definition.
  2. Add an entry for that agent in opencode.json to override its model:
    {
      "agents": {
        "subagent-name": {
          "model": "faster-cheaper-model"
        }
      }
    }
    

Restart OpenCode or reload the session.
Press Tab in the footer or look at the agent selector.

Expected behavior
The subagent should remain a subagent (hidden from the footer/Tab selector) because its canonical definition in the .md file specifies mode: subagent. Config overrides should only affect model/settings, not the agent mode.
Actual behavior
All agents present in opencode.json are forcibly treated as primary agents. The footer/Tab selector now shows many entries instead of only the true primary agents.
Workaround (confirmed working)

Remove the agent entry from opencode.json, or
Explicitly add "mode": "subagent" inside the config entry.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions