fix: respect user-configured category model over fallbackChain defaults
When a user configures a custom model for a category (e.g. quick.model), the hardcoded CATEGORY_MODEL_REQUIREMENTS fallbackChain was overriding it. This caused the user's model to be ignored and replaced with the default (e.g. openai/gpt-5.4-mini). Fix: - Use userModelOverride directly instead of potentially stale actualModel - Suppress hardcoded fallbackChain when explicitCategoryModel is provided - Add regression test verifying user category model takes precedence Closes #3040
This commit is contained in:
@@ -452,4 +452,36 @@ describe("resolveCategoryExecution", () => {
|
||||
cacheSpy.mockRestore()
|
||||
agentsSpy.mockRestore()
|
||||
})
|
||||
|
||||
test("does not inherit hardcoded fallbackChain when user configures a category model [regression #3040]", async () => {
|
||||
//#given
|
||||
const args = {
|
||||
category: "quick",
|
||||
prompt: "test prompt",
|
||||
description: "Test task",
|
||||
run_in_background: false,
|
||||
load_skills: [],
|
||||
blockedBy: undefined,
|
||||
enableSkillTools: false,
|
||||
}
|
||||
const executorCtx = createMockExecutorContext()
|
||||
executorCtx.userCategories = {
|
||||
quick: {
|
||||
model: "animal-gateway-xai/grok-4-fast-non-reasoning",
|
||||
},
|
||||
}
|
||||
|
||||
//#when
|
||||
const result = await resolveCategoryExecution(args, executorCtx, undefined, "anthropic/claude-sonnet-4-6")
|
||||
|
||||
//#then
|
||||
expect(result.error).toBeUndefined()
|
||||
expect(result.actualModel).toBe("animal-gateway-xai/grok-4-fast-non-reasoning")
|
||||
expect(result.categoryModel).toEqual({
|
||||
providerID: "animal-gateway-xai",
|
||||
modelID: "grok-4-fast-non-reasoning",
|
||||
variant: undefined,
|
||||
})
|
||||
expect(result.fallbackChain).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user