The open source coding agent.
TypeScript
fix: add xhigh reasoning effort for GitHub Copilot GPT-5 models (#10092)
Arthurcf7e10c4e815
diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.tsindex 5e9f10fe627..0ce5214a21c 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.tsindex 6ebac7d28b9..037083d5e30 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({