fix(anthropic-effort): skip effort injection for Haiku models (#3308)

Haiku models do not support the effort parameter and return API errors
when it is passed. The hook now explicitly checks for Haiku model
patterns and skips effort injection, preventing silent title generation
failures.

Added EFFORT_UNSUPPORTED_PATTERN and isEffortUnsupportedModel() to
detect and skip Haiku models.

Fixes #3308
This commit is contained in:
YeonGyu-Kim
2026-04-11 13:06:24 +09:00
parent 29c27ad408
commit 7c154c6659
2 changed files with 31 additions and 0 deletions
+24
View File
@@ -147,6 +147,30 @@ describe("createAnthropicEffortHook", () => {
expect(output.options.effort).toBeUndefined()
})
describe("#given haiku models (effort unsupported)", () => {
const haikuModels = [
"claude-haiku-4-5",
"claude-haiku-4.6",
"claude-haiku",
"claude-haiku-20240307",
]
for (const modelID of haikuModels) {
it(`skips effort injection for ${modelID}`, async () => {
// given
const hook = createAnthropicEffortHook()
const { input, output } = createMockParams({ modelID })
// when
await hook["chat.params"](input, output)
// then
expect(output.options.effort).toBeUndefined()
expect(input.message.variant).toBe("max")
})
}
})
})
describe("existing options", () => {