fix(agents): honor user atlas model when resolution returns undefined (#4255)
Atlas was the only agent that bailed early (returning undefined) when applyModelResolution returned undefined, even if the user had explicitly configured agents.atlas.model. The general-agents.ts path already handled this case by falling back to the user's override; sisyphus has its own explicit-config check. Atlas had neither, so under edge cases (cold provider cache, no system default, empty availableModels) Atlas was silently dropped and OpenCode used its built-in default — surfaced as the hardcoded claude-sonnet-4-6 in the reported bug. This aligns atlas-agent.ts with the same defensive pattern used in general-agents.ts: when resolution fails but the user has an explicit model override, honor it directly instead of dropping the agent. Adds a regression test covering the scenario where availableModels is empty AND systemDefaultModel is undefined AND no provider cache exists.
This commit is contained in:
@@ -38,7 +38,7 @@ export function maybeCreateAtlasConfig(input: {
|
||||
const orchestratorOverride = agentOverrides["atlas"]
|
||||
const atlasRequirement = AGENT_MODEL_REQUIREMENTS["atlas"]
|
||||
|
||||
const atlasResolution = applyModelResolution({
|
||||
let atlasResolution = applyModelResolution({
|
||||
uiSelectedModel: orchestratorOverride?.model !== undefined ? undefined : uiSelectedModel,
|
||||
userModel: orchestratorOverride?.model,
|
||||
requirement: atlasRequirement,
|
||||
@@ -46,6 +46,12 @@ export function maybeCreateAtlasConfig(input: {
|
||||
systemDefaultModel,
|
||||
})
|
||||
|
||||
if (!atlasResolution && orchestratorOverride?.model) {
|
||||
// User explicitly configured a model but resolution failed (e.g., cold cache, no system default).
|
||||
// Honor the user's choice directly instead of dropping Atlas entirely.
|
||||
atlasResolution = { model: orchestratorOverride.model, provenance: "override" as const }
|
||||
}
|
||||
|
||||
if (!atlasResolution) return undefined
|
||||
const { model: atlasModel, variant: atlasResolvedVariant } = atlasResolution
|
||||
|
||||
|
||||
Reference in New Issue
Block a user