From cf7e10c4e8151f1d49168eb12bab06070f70848b Mon Sep 17 00:00:00 2001 From: Arthur <133686826+Arthur742Ramos@users.noreply.github.com> Date: Sat, 24 Jan 2026 02:09:47 -0300 Subject: [PATCH] fix: add xhigh reasoning effort for GitHub Copilot GPT-5 models (#10092) Co-authored-by: Arthur Freitas Ramos --- packages/opencode/src/provider/transform.ts | 6 +- .../opencode/test/provider/transform.test.ts | 96 +++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 5e9f10fe6..0ce5214a2 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -349,8 +349,12 @@ export namespace ProviderTransform { return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }])) case "@ai-sdk/github-copilot": + const copilotEfforts = iife(() => { + if (id.includes("5.1-codex-max") || id.includes("5.2")) return [...WIDELY_SUPPORTED_EFFORTS, "xhigh"] + return WIDELY_SUPPORTED_EFFORTS + }) return Object.fromEntries( - WIDELY_SUPPORTED_EFFORTS.map((effort) => [ + copilotEfforts.map((effort) => [ effort, { reasoningEffort: effort, diff --git a/packages/opencode/test/provider/transform.test.ts b/packages/opencode/test/provider/transform.test.ts index 6ebac7d28..037083d5e 100644 --- a/packages/opencode/test/provider/transform.test.ts +++ b/packages/opencode/test/provider/transform.test.ts @@ -1224,6 +1224,102 @@ describe("ProviderTransform.variants", () => { }) }) + describe("@ai-sdk/github-copilot", () => { + test("standard models return low, medium, high", () => { + const model = createMockModel({ + id: "gpt-4.5", + providerID: "github-copilot", + api: { + id: "gpt-4.5", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high"]) + expect(result.low).toEqual({ + reasoningEffort: "low", + reasoningSummary: "auto", + include: ["reasoning.encrypted_content"], + }) + }) + + test("gpt-5.1-codex-max includes xhigh", () => { + const model = createMockModel({ + id: "gpt-5.1-codex-max", + providerID: "github-copilot", + api: { + id: "gpt-5.1-codex-max", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"]) + }) + + test("gpt-5.1-codex-mini does not include xhigh", () => { + const model = createMockModel({ + id: "gpt-5.1-codex-mini", + providerID: "github-copilot", + api: { + id: "gpt-5.1-codex-mini", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high"]) + }) + + test("gpt-5.1-codex does not include xhigh", () => { + const model = createMockModel({ + id: "gpt-5.1-codex", + providerID: "github-copilot", + api: { + id: "gpt-5.1-codex", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high"]) + }) + + test("gpt-5.2 includes xhigh", () => { + const model = createMockModel({ + id: "gpt-5.2", + providerID: "github-copilot", + api: { + id: "gpt-5.2", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"]) + expect(result.xhigh).toEqual({ + reasoningEffort: "xhigh", + reasoningSummary: "auto", + include: ["reasoning.encrypted_content"], + }) + }) + + test("gpt-5.2-codex includes xhigh", () => { + const model = createMockModel({ + id: "gpt-5.2-codex", + providerID: "github-copilot", + api: { + id: "gpt-5.2-codex", + url: "https://api.githubcopilot.com", + npm: "@ai-sdk/github-copilot", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"]) + }) + }) + describe("@ai-sdk/cerebras", () => { test("returns WIDELY_SUPPORTED_EFFORTS with reasoningEffort", () => { const model = createMockModel({