fix(plan-agent): only inherit model from prometheus as fallback

Plan agent was incorrectly inheriting prometheus's entire config (prompt,
permission, etc.) causing it to behave as primary instead of subagent.

Now plan agent:
1. Uses plan config model if explicitly set
2. Falls back to prometheus model only if plan config has no model
3. Keeps original OpenCode plan config intact
This commit is contained in:
justsisyphus
2026-01-27 15:17:27 +09:00
parent 655d511294
commit d481c596bd

View File

@@ -306,8 +306,15 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
? migrateAgentConfig(configAgent.build as Record<string, unknown>)
: {};
const planDemoteConfig = replacePlan && agentConfig["prometheus"]
? { ...agentConfig["prometheus"], name: "plan", mode: "subagent" as const }
const prometheusModel = (agentConfig["prometheus"] as { model?: string })?.model;
const planConfigModel = (configAgent?.plan as { model?: string })?.model;
const planDemoteConfig = replacePlan && (planConfigModel || prometheusModel)
? {
...configAgent?.plan,
model: planConfigModel || prometheusModel,
name: "plan",
mode: "subagent" as const
}
: undefined;
config.agent = {