From 593903fb5ce8843d1a84a64787f8103b92a31fee Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Fri, 29 May 2026 13:56:03 +0000 Subject: [PATCH] feat(cli): treat opus 4.8 as adaptive thinking model like 4.7 --- .changeset/opus-4-8-adaptive-thinking.md | 5 +++ .../src/plugin/github-copilot/models.ts | 4 +- packages/opencode/src/provider/transform.ts | 12 +++-- .../test/kilocode/transform-opus-4.7.test.ts | 44 +++++++++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 .changeset/opus-4-8-adaptive-thinking.md diff --git a/.changeset/opus-4-8-adaptive-thinking.md b/.changeset/opus-4-8-adaptive-thinking.md new file mode 100644 index 00000000000..38f6a547763 --- /dev/null +++ b/.changeset/opus-4-8-adaptive-thinking.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Treat Claude Opus 4.8 as an adaptive thinking model, matching Opus 4.7. diff --git a/packages/opencode/src/plugin/github-copilot/models.ts b/packages/opencode/src/plugin/github-copilot/models.ts index acccf146d0f..e2524288b72 100644 --- a/packages/opencode/src/plugin/github-copilot/models.ts +++ b/packages/opencode/src/plugin/github-copilot/models.ts @@ -125,7 +125,9 @@ function build(key: string, remote: Item, url: string, prev?: Model): Model { variants[effort] = { thinking: { type: "adaptive", - ...(model.api.id.includes("opus-4.7") ? { display: "summarized" } : {}), + ...(model.api.id.includes("opus-4.7") || model.api.id.includes("opus-4.8") + ? { display: "summarized" } + : {}), // kilocode_change - treat opus-4.8 like opus-4.7 }, effort, } diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index ab7a81ec818..c90ad794087 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -542,7 +542,8 @@ function openaiReasoningEfforts(apiId: string, releaseDate: string): string[] | } function anthropicAdaptiveEfforts(apiId: string): string[] | null { - if (["opus-4-7", "opus-4.7"].some((v) => apiId.includes(v))) { + if (["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => apiId.includes(v))) { + // kilocode_change - treat opus-4.8 like opus-4.7 return ["low", "medium", "high", "xhigh", "max"] } if (["opus-4-6", "opus-4.6", "sonnet-4-6", "sonnet-4.6"].some((v) => apiId.includes(v))) { @@ -780,7 +781,8 @@ export function variants(model: Provider.Model): Record model.api.id.includes(v)) ? { display: "summarized" } : {}), }, @@ -827,7 +830,8 @@ export function variants(model: Provider.Model): Record model.api.id.includes(v)) ? { display: "summarized" } : {}), }, diff --git a/packages/opencode/test/kilocode/transform-opus-4.7.test.ts b/packages/opencode/test/kilocode/transform-opus-4.7.test.ts index 66c9b1d850e..59584a44a1a 100644 --- a/packages/opencode/test/kilocode/transform-opus-4.7.test.ts +++ b/packages/opencode/test/kilocode/transform-opus-4.7.test.ts @@ -75,6 +75,50 @@ describe("ProviderTransform.variants - Claude Opus 4.7", () => { }) }) + test("opus-4-8 returns adaptive thinking variants including xhigh (native anthropic)", () => { + const model = mockModel({ + api: { + id: "claude-opus-4-8", + url: "https://api.anthropic.com", + npm: "@ai-sdk/anthropic", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"]) + expect(result.xhigh).toEqual({ + thinking: { type: "adaptive", display: "summarized" }, + effort: "xhigh", + }) + }) + + test("opus-4.8 dot-form returns adaptive thinking variants via @ai-sdk/gateway", () => { + const model = mockModel({ + id: "anthropic/claude-opus-4-8", + api: { + id: "anthropic/claude-opus-4.8", + url: "https://gateway.ai", + npm: "@ai-sdk/gateway", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"]) + }) + + test("opus-4-8 on bedrock returns adaptive reasoningConfig with xhigh", () => { + const model = mockModel({ + api: { + id: "anthropic.claude-opus-4-8", + url: "https://bedrock.amazonaws.com", + npm: "@ai-sdk/amazon-bedrock", + }, + }) + const result = ProviderTransform.variants(model) + expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"]) + expect(result.xhigh).toEqual({ + reasoningConfig: { type: "adaptive", maxReasoningEffort: "xhigh", display: "summarized" }, + }) + }) + test("opus-4-6 keeps original adaptive efforts without xhigh", () => { const model = mockModel({ api: {