Skip to content

[Bug]: Custom model configuration in oh-my-opencode.json is ignored when model name does not match hardcoded official model list #2740

@Alkacid

Description

@Alkacid

Prerequisites

  • I will write this issue in English (see our Language Policy)
  • I have searched existing issues to avoid duplicates
  • I am using the latest version of oh-my-opencode
  • I have read the documentation or asked an AI coding agent with this project's GitHub URL loaded and couldn't find the answer

Bug Description

I am trying to configure a custom model for a specific subagent/category via oh-my-opencode.json, but the configuration is ignored when the model name does not appear in the hardcoded official model list.

Steps to Reproduce

configured the writing category to use a custom model from a custom provider:

"writing": {
  "model": "new-api-openai/gpt-5.4-high"
}

Expected Behavior

When a user explicitly specifies a model for a subagent/category in oh-my-opencode.json, that configuration should take precedence over any hardcoded default logic. The system should:

  1. First check if the user has explicitly configured a model for this subagent
  2. If yes, use that model (after validating it exists in the provider list)
  3. Only fall back to hardcoded defaults when no explicit user configuration exists

Actual Behavior

The model matching logic appears to work as follows:

  • First, it extracts the model name (e.g., gpt-5.4)
  • Then it checks if this name exists in a hardcoded official model list
  • If the name matches an official model, it uses that model
  • If the name does NOT match (e.g., customed gpt-5.4-high or any custom-named model from a custom provider), the entire configuration entry is ignored
  • The system then falls back to a default model that I never configured, bypassing my explicit setting(e.g., category writing leads to claude-sonnet-4-6),then subagent faild.

Doctor Output

1. Model override uses unavailable provider
   Provider(s) not found in OpenCode model cache: new-api-openai, bailian-coding-plan
   Affects: model resolution

Error Logs

Configuration

Additional Context

Impact:

This makes it impossible to use custom-named models from custom providers for specific subagents, even when those models are correctly defined in opencode.json. Users who use third-party API proxies or custom model aliases cannot reliably control which model each subagent uses.

Suggested fix:

Change the model resolution priority to:

  1. User's explicit per-subagent configuration in oh-my-opencode.json (highest priority)
  2. Hardcoded official model list (lower priority)
  3. Global default (lowest priority)

Alternatively, at minimum, when a user-configured model name does not match the official list, the system should:

  • Log a warning instead of silently ignoring
  • Still attempt to use the configured model if it exists in the provider definitions

Operating System

Windows

OpenCode Version

1.2.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions