From 38d2e1ebba3536c5ed84a9afdac54fde4c70cdfc Mon Sep 17 00:00:00 2001 From: spiceoogway Date: Fri, 30 Jan 2026 09:06:06 -0500 Subject: [PATCH] fix: use agent-specific model config in allowlist validation Fixes #4587 When an agent has a specific model configured via agents.list[].model, the model was correctly resolved but then incorrectly validated against the global model allowlist instead of the agent-specific config. This caused the agent to fall back to the default model even when a specific model was configured for that agent. The fix ensures that buildAllowedModelSet uses the same modified config (cfgForModelSelection) that includes the agent-specific model override, rather than the original config. Example config that was broken: { "agents": { "list": [ { "id": "researcher", "model": "anthropic/claude-opus-4-5" } ], "defaults": { "models": { "anthropic/claude-sonnet-4-5": { "alias": "sonnet" } } } } } Before: researcher agent would use sonnet (allowlist rejected opus) After: researcher agent uses opus (allowlist includes agent-specific model) --- src/commands/agent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/agent.ts b/src/commands/agent.ts index 0bcb444b9..38fcfd92b 100644 --- a/src/commands/agent.ts +++ b/src/commands/agent.ts @@ -265,7 +265,7 @@ export async function agentCommand( if (needsModelCatalog) { modelCatalog = await loadModelCatalog({ config: cfg }); const allowed = buildAllowedModelSet({ - cfg, + cfg: cfgForModelSelection, catalog: modelCatalog, defaultProvider, defaultModel,