From d481c596bde619b031cb196e795dd19938a1fd71 Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Tue, 27 Jan 2026 15:17:27 +0900 Subject: [PATCH] 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 --- src/plugin-handlers/config-handler.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index 123f806d5..7770b848b 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -306,8 +306,15 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { ? migrateAgentConfig(configAgent.build as Record) : {}; - 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 = {