Skip to content

Commit c6595be

Browse files
committed
Add OmO agent model fallback chain to inherit OpenCode system default (#79)
- Add systemDefaultModel parameter to createBuiltinAgents() function - Implement model fallback priority chain for OmO agent: 1. oh-my-opencode.json agents.OmO.model (explicit override) 2. OpenCode system config.model (system default) 3. Hardcoded default in omoAgent (fallback) - Pass config.model from OpenCode settings to createBuiltinAgents() This fixes issue #79 where users couldn't change agent models via OpenCode config. 🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode)
1 parent e144dd5 commit c6595be

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/agents/utils.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ function mergeAgentConfig(
6262
export function createBuiltinAgents(
6363
disabledAgents: BuiltinAgentName[] = [],
6464
agentOverrides: AgentOverrides = {},
65-
directory?: string
65+
directory?: string,
66+
systemDefaultModel?: string
6667
): Record<string, AgentConfig> {
6768
const result: Record<string, AgentConfig> = {}
6869

@@ -84,6 +85,18 @@ export function createBuiltinAgents(
8485
}
8586

8687
const override = agentOverrides[agentName]
88+
89+
// Apply model fallback chain for OmO agent:
90+
// 1. oh-my-opencode.json agents.OmO.model (highest priority)
91+
// 2. OpenCode system config.model (middle priority)
92+
// 3. Hardcoded default in omoAgent (lowest priority / fallback)
93+
if (agentName === "OmO" && systemDefaultModel && !override?.model) {
94+
finalConfig = {
95+
...finalConfig,
96+
model: systemDefaultModel,
97+
}
98+
}
99+
87100
if (override) {
88101
result[name] = mergeAgentConfig(finalConfig, override)
89102
} else {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
294294
pluginConfig.disabled_agents,
295295
pluginConfig.agents,
296296
ctx.directory,
297+
config.model,
297298
);
298299

299300
const userAgents = (pluginConfig.claude_code?.agents ?? true) ? loadUserAgents() : {};

0 commit comments

Comments
 (0)