Skip to content

agent.model override does not apply to built-in subagents (general, explore) #21952

Description

@fs-bmedkouri

Bug

The agent.model config override in opencode.jsonc does not take effect for built-in subagents (general, explore). They inherit the primary model regardless of the configured override.

Reproduction

  1. Set the primary model to Opus 4 (claude-opus-4-6)
  2. Add the following to opencode.jsonc:
"agent": {
  "general": {
    "model": "anthropic/claude-sonnet-4-20250514"
  },
  "explore": {
    "model": "anthropic/claude-sonnet-4-20250514"
  }
}
  1. Start a new OpenCode session (confirmed config is loaded at session start)
  2. Invoke a Task tool that uses the explore subagent
  3. Query the local API: GET /session/{subagent-session-id}/message

Expected

The subagent assistant message shows "modelID": "claude-sonnet-4-20250514"

Actual

The subagent assistant message shows "modelID": "claude-opus-4-6" -- the primary model, not the configured override.

API response excerpt:

{
  "modelID": "claude-opus-4-6",
  "providerID": "anthropic",
  "cost": 0.084715,
  "tokens": { "total": 13492, "input": 3, "output": 21, "cache": { "write": 13468, "read": 0 } }
}

The cost ($0.085 for ~13.5k tokens) confirms Opus pricing, not Sonnet.

Verification

  • Config syntax is correct (matches docs examples exactly)
  • Config parses successfully (validated with PowerShell JSON parser)
  • This is a fresh session (not a mid-session config change)
  • The small_model config in the same file does work

Environment

  • OpenCode v1.4.3
  • Windows 11
  • Provider: Anthropic (direct)
  • Primary model: claude-opus-4-6

Docs reference

https://opencode.ai/docs/agents#model shows this should work:

{
  "agent": {
    "plan": {
      "model": "anthropic/claude-haiku-4-20250514"
    }
  }
}

Activity

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions