Skip to content

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

Closed as not planned

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

Activity

  1. changed the title [-]Bug: Subagents listed in `opencode.json` are incorrectly treated as primary agents (ignoring `mode: subagent` from agent files)[/-] [+][Bug]: Subagents listed in `opencode.json` are incorrectly treated as primary agents (ignoring `mode: subagent` from agent files)[/+] on Apr 12, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 12, 2026
  3. github-actions commented on Apr 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If the underlying bug (config overrides dropping the mode from the .md definition) is distinct from #21364, please clarify in this issue so maintainers can track them separately.

  4. AMythicDev commented on Apr 12, 2026

    @AMythicDev

    I also encountered this on OC 1.4.1. If I set the mode in the .md to primary and don't explicitly configure it in opencode.json, it is still listed as both a primary and a subagent. Effectively, the option seems to be getting ignored.

    OpenCode version

    v1.4.1

    Operating System

    Arch Linux

    Terminal

    WezTerm

  5. PassionPI commented on Apr 15, 2026

    @PassionPI

    I also encountered this on OC 1.4.1. If I set the mode in the .md to primary and don't explicitly configure it in opencode.json, it is still listed as both a primary and a subagent. Effectively, the option seems to be getting ignored.

    OpenCode version

    v1.4.1

    Operating System

    Arch Linux

    Terminal

    WezTerm

    me too, also ignore the model that i wrote in ~/.config/opencode/agents/xx.md

  6. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions