fix(anthropic-effort): skip effort injection for github-copilot provider (#3270)
github-copilot routes Claude models but rejects the Anthropic effort parameter. Added an explicit guard so effort is no longer injected when the provider ID is github-copilot, while preserving native Anthropic provider support. 🤖 Generated with OhMyOpenCode assistance https://github.com/code-yeongyu/oh-my-opencode
This commit is contained in:
@@ -65,6 +65,7 @@ export function createAnthropicEffortHook() {
|
|||||||
if (isEffortUnsupportedModel(model.modelID)) return
|
if (isEffortUnsupportedModel(model.modelID)) return
|
||||||
if (message.variant !== "max") return
|
if (message.variant !== "max") return
|
||||||
if (!isClaudeProvider(model.providerID, model.modelID)) return
|
if (!isClaudeProvider(model.providerID, model.modelID)) return
|
||||||
|
if (model.providerID === "github-copilot") return
|
||||||
if (shouldSkipForInternalAgent(agent?.name)) return
|
if (shouldSkipForInternalAgent(agent?.name)) return
|
||||||
if (output.options.effort !== undefined) return
|
if (output.options.effort !== undefined) return
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,22 @@ describe("createAnthropicEffortHook", () => {
|
|||||||
expect(output.options.effort).toBeUndefined()
|
expect(output.options.effort).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("#given github-copilot + claude model #then effort NOT injected", async () => {
|
||||||
|
// given
|
||||||
|
const hook = createAnthropicEffortHook()
|
||||||
|
const { input, output } = createMockParams({
|
||||||
|
providerID: "github-copilot",
|
||||||
|
modelID: "claude-opus-4-6",
|
||||||
|
})
|
||||||
|
|
||||||
|
// when
|
||||||
|
await hook["chat.params"](input, output)
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(output.options.effort).toBeUndefined()
|
||||||
|
expect(input.message.variant).toBe("max")
|
||||||
|
})
|
||||||
|
|
||||||
describe("#given haiku models (effort unsupported)", () => {
|
describe("#given haiku models (effort unsupported)", () => {
|
||||||
const haikuModels = [
|
const haikuModels = [
|
||||||
"claude-haiku-4-5",
|
"claude-haiku-4-5",
|
||||||
|
|||||||
Reference in New Issue
Block a user