fix: slug-generator uses effective model instead of agent-primary

resolveAgentModelPrimary() only checks the agent-level model config and
does not fall back to the system-wide default. When users configure a
non-Anthropic provider (e.g. Gemini, Minimax) as their global default
without setting it at the agent level, the slug-generator falls through
to DEFAULT_PROVIDER (anthropic) and fails with a missing API key error.

Switch to resolveAgentEffectiveModelPrimary() which correctly respects
the full model resolution chain including global defaults.

Fixes #25365
This commit is contained in:
SudeepMalipeddi
2026-02-24 19:39:16 +05:30
committed by Peter Steinberger
parent 5e6fe9c160
commit d32298cbd8

View File

@@ -9,7 +9,7 @@ import {
resolveDefaultAgentId,
resolveAgentWorkspaceDir,
resolveAgentDir,
resolveAgentModelPrimary,
resolveAgentEffectiveModelPrimary,
} from "../agents/agent-scope.js";
import { DEFAULT_PROVIDER, DEFAULT_MODEL } from "../agents/defaults.js";
import { parseModelRef } from "../agents/model-selection.js";
@@ -45,7 +45,7 @@ ${params.sessionContent.slice(0, 2000)}
Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design", "bug-fix"`;
// Resolve model from agent config instead of using hardcoded defaults
const modelRef = resolveAgentModelPrimary(params.cfg, agentId);
const modelRef = resolveAgentEffectiveModelPrimary(params.cfg, agentId);
const parsed = modelRef ? parseModelRef(modelRef, DEFAULT_PROVIDER) : null;
const provider = parsed?.provider ?? DEFAULT_PROVIDER;
const model = parsed?.model ?? DEFAULT_MODEL;