fix(anthropic-effort): clamp variant=max for github-copilot Claude models

GitHub Copilot proxies Anthropic's API but does not support
output_config.effort: "max" (same constraint as Anthropic OAuth).

Previously the anthropic-effort hook early-returned for github-copilot
provider, skipping all effort clamping. Users on github-copilot/claude-opus-4.6
with variant=max got HTTP 400 'invalid_reasoning_effort'.

Fix: Remove the github-copilot early return. Treat github-copilot as a
constrained provider (alongside Anthropic OAuth), clamping max→high.

Rename isAnthropicOAuth→isConstrainedProvider to reflect the broader scope.

Fixes the remaining user report from #3429.
This commit is contained in:
YeonGyu-Kim
2026-04-16 18:41:09 +09:00
parent a5ae0b838c
commit 1ae32283ef
2 changed files with 33 additions and 16 deletions
+19 -3
View File
@@ -153,7 +153,7 @@ describe("createAnthropicEffortHook", () => {
expect(output.options.effort).toBeUndefined()
})
it("#given github-copilot + claude model #then effort NOT injected", async () => {
it("#given github-copilot + claude opus model #then effort clamped to high (constrained provider)", async () => {
// given
const hook = createAnthropicEffortHook()
const { input, output } = createMockParams({
@@ -164,9 +164,25 @@ describe("createAnthropicEffortHook", () => {
// when
await hook["chat.params"](input, output)
// then — github-copilot is a constrained provider, clamps max→high
expect(output.options.effort).toBe("high")
expect(input.message.variant).toBe("high")
})
it("#given github-copilot + claude sonnet model #then effort clamped to high", async () => {
// given
const hook = createAnthropicEffortHook()
const { input, output } = createMockParams({
providerID: "github-copilot",
modelID: "claude-sonnet-4-6",
})
// when
await hook["chat.params"](input, output)
// then
expect(output.options.effort).toBeUndefined()
expect(input.message.variant).toBe("max")
expect(output.options.effort).toBe("high")
expect(input.message.variant).toBe("high")
})
describe("#given haiku models (effort unsupported)", () => {