fix(agent-registration): always attempt fallback when model resolution fails
Removes both the isFirstRunNoCache and override?.model guards from the fallback logic in collectPendingBuiltinAgents(). Previously, when a user configured a model like minimax/MiniMax-M2.5 that wasn't in availableModels, the agent was silently excluded and --agent Librarian would crash with 'undefined is not an object'. Now: if applyModelResolution() fails for ANY reason (cache state, unavailable model, config merge issue), getFirstFallbackModel() is always attempted. A log warning is emitted when a user-configured model couldn't be resolved, making the previously silent failure visible. Supersedes #2517 Fixes #2427
This commit is contained in:
@@ -8,6 +8,7 @@ import { buildAgent, isFactory } from "../agent-builder"
|
||||
import { applyOverrides } from "./agent-overrides"
|
||||
import { applyEnvironmentContext } from "./environment-context"
|
||||
import { applyModelResolution, getFirstFallbackModel } from "./model-resolution"
|
||||
import { log } from "../../shared/logger"
|
||||
|
||||
export function collectPendingBuiltinAgents(input: {
|
||||
agentSources: Record<BuiltinAgentName, import("../agent-builder").AgentSource>
|
||||
@@ -75,7 +76,13 @@ export function collectPendingBuiltinAgents(input: {
|
||||
availableModels,
|
||||
systemDefaultModel,
|
||||
})
|
||||
if (!resolution && isFirstRunNoCache && !override?.model) {
|
||||
if (!resolution) {
|
||||
if (override?.model) {
|
||||
log("[agent-registration] User-configured model could not be resolved, falling back", {
|
||||
agent: agentName,
|
||||
configuredModel: override.model,
|
||||
})
|
||||
}
|
||||
resolution = getFirstFallbackModel(requirement)
|
||||
}
|
||||
if (!resolution) continue
|
||||
|
||||
Reference in New Issue
Block a user