Repository navigation
Description
Summary
When configuring custom provider models for agents in oh-my-opencode.json, the configuration is correctly parsed and validated by opencode debug agent <name>, but at runtime the subagent uses built-in opencode/* models instead of the configured custom provider models.
Environment
- oh-my-opencode version: 3.12.3
- opencode version: 1.2.27
- Platform: macOS (darwin)
Configuration
~/.config/opencode/opencode.json:
{
"plugin": ["oh-my-opencode"],
"provider": {
"opencode-go": {
"npm": "@ai-sdk/anthropic",
"name": "GenStudio (Anthropic Compatible)",
"options": {
"baseURL": "https://cloud.infini-ai.com/maas/coding/v1",
"apiKey": "{env:GENSTUDIO_API_KEY}"
},
"models": {
"minimax-m2.5": { "name": "MiniMax M2.5" },
"minimax-m2.7": { "name": "MiniMax M2.7" },
"glm-5": { "name": "GLM-5" }
}
}
}
}~/.config/opencode/oh-my-opencode.json:
{
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
"agents": {
"explore": {
"model": "opencode-go/minimax-m2.7",
"fallback_models": ["opencode-go/minimax-m2.7", "opencode-go/minimax-m2.5"],
"description": "Code exploration agent"
},
"librarian": {
"model": "opencode-go/glm-5",
"fallback_models": ["opencode-go/glm-5", "opencode-go/minimax-m2.7"]
}
}
}Steps to Reproduce
- Configure a custom provider with models (as shown above)
- Verify the configuration is correct:
opencode debug agent explore # Output shows: "model": { "providerID": "opencode-go", "modelID": "minimax-m2.7" } - Test direct model usage (works correctly):
opencode run -m opencode-go/minimax-m2.7 "Say: test" # Output: correctly uses minimax-m2.7
- Test via subagent task:
task(subagent_type="explore", prompt="Say what model you are using") - Observe the actual model used in the response
Expected Behavior
The subagent should use the configured model opencode-go/minimax-m2.7.
Actual Behavior
The subagent returns using minimax-m2.5-free (from built-in opencode provider):
[assistant (explore)] explore agent using: minimax-m2.5-free
Debug Information
Provider models cache (~/.cache/oh-my-opencode/provider-models.json):
opencode-gois inconnectedlistopencode-go/minimax-m2.7is in available models
Model resolution simulation:
// Simulating resolveModelForDelegateTask
userModel: "opencode-go/minimax-m2.7"
fuzzyMatchModel result: "opencode-go/minimax-m2.7" // ✅ Correct
resolution: { model: "opencode-go/minimax-m2.7" } // ✅ CorrectConnected providers:
['opencode', 'opencode-go', 'kimi-for-coding', ...]
Analysis
I traced through the code and found:
- Configuration parsing is correct:
opencode debug agent exploreshows the correct model - Model resolution returns correct value:
resolveModelForDelegateTask()returnsopencode-go/minimax-m2.7 - Direct model invocation works:
opencode run -m opencode-go/minimax-m2.7succeeds - But subagent uses wrong model: The actual runtime model is
opencode/minimax-m2.5-free
Possible causes:
- The
promptAsynccall instartTask()may not correctly pass the custom provider model to the session - There may be an implicit fallback to built-in
opencodeprovider models - The session model may be resolved differently at runtime vs configuration time
Relevant code paths:
resolveSubagentExecution()→resolveModelForDelegateTask()→categoryModel(correct)executeBackgroundTask()→manager.launch({ model: categoryModel })(should be correct)startTask()→promptWithModelSuggestionRetry({ body: { model: launchModel } })(should be correct)
Workaround Attempted
I tried adding fallback_models to the agent configuration, but the issue persists:
{
"agents": {
"explore": {
"model": "opencode-go/minimax-m2.7",
"fallback_models": ["opencode-go/minimax-m2.7", "opencode-go/minimax-m2.5"]
}
}
}Questions
- Is there a specific configuration needed for custom provider models to work with subagents?
- Is there a runtime model resolution that differs from the configuration-time resolution?
- Are there any logs I can enable to trace the actual model being used at runtime?
Activity
iceblove commentedon Mar 22, 2026
Update: Root Cause Identified
After further investigation, I found that this issue is actually in opencode core, not oh-my-opencode.
Evidence
Database records show that when a subagent is launched with
agent: "explore", the model in the user message is already wrong:The
modelparameter passed topromptAsyncisopencode-go/minimax-m2.7, but the database showsopencode/minimax-m2.5-free.Root Cause
OpenCode core has built-in fallback chains for agents. When processing a session prompt with an
agentparameter, opencode overrides themodelparameter with the agent's built-in fallback chain.Comparison
model: opencode-go/minimax-m2.7agent: explore, model: opencode-go/minimax-m2.7Related Issue
Filed in opencode repo: anomalyco/opencode#18615
This issue can be closed as it's a bug in opencode core, not oh-my-opencode.
TrueHOOHA commentedon Mar 23, 2026
I found this issue too. I don't have any Claude models in my provider list, and I didn't change anything Omo agent default models. When Sisyphus calls subagent to work. It always stuck with some subagent using Claude models not what my providers has.
fix: resolve 3 bugs - subagent model override, empty plan completion,…
Merge pull request #2780 from code-yeongyu/fix/issues-2741-2648-2779