From 2d814cd652a63e267c80ae6cae46c31cf6e2106d Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Fri, 3 Jul 2026 14:02:53 +0200 Subject: [PATCH] fix(cli): expose off variant and add kilo gateway branch for GLM 5.2 GLM 5.2's reasoning variant mapping in ProviderTransform.variants had two gaps introduced by PR #11555, which adapted upstream commit 22cc758b1a: 1. The @kilocode/kilo-gateway package was not covered, so the gateway fell through to the generic GLM binary toggle (instant/thinking) instead of GLM 5.2's native effort levels. This made the Kilo gateway show only two reasoning efforts while the cloud already pushes none/high/xhigh via REASONING_VARIANTS_NONE_HIGH_XHIGH. 2. The off (none) variant was dropped from the openrouter, openai-compatible, and anthropic branches, leaving each at only two variants and regressing custom openai-compatible providers (e.g. wafer) that previously exposed three. This mirrors the cloud's three-variant definition (none/high/xhigh for the gateway and openrouter; none/high/max for openai-compatible and anthropic, matching z.ai native naming) and adds a kilo-gateway case so the computed fallback matches the config the gateway pushes. --- .changeset/fix-glm-52-reasoning-variants.md | 5 +++++ packages/opencode/src/provider/transform.ts | 14 ++++++++++++ .../opencode/test/provider/transform.test.ts | 22 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .changeset/fix-glm-52-reasoning-variants.md diff --git a/.changeset/fix-glm-52-reasoning-variants.md b/.changeset/fix-glm-52-reasoning-variants.md new file mode 100644 index 0000000000..a27fa9758f --- /dev/null +++ b/.changeset/fix-glm-52-reasoning-variants.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Restore the off reasoning variant for GLM 5.2 and add the missing Kilo gateway branch so the effort selector shows all three supported levels (off/high/xhigh) instead of only two. diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index f661d9d633..5844de50eb 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -669,21 +669,35 @@ export function variants(model: Provider.Model): Record { }, }) expect(ProviderTransform.variants(model)).toEqual({ + none: { reasoningEffort: "none" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" }, }) @@ -2555,6 +2556,7 @@ describe("ProviderTransform.variants", () => { }, }) expect(ProviderTransform.variants(model)).toEqual({ + none: { reasoningEffort: "none" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" }, }) @@ -2571,6 +2573,7 @@ describe("ProviderTransform.variants", () => { }, }) expect(ProviderTransform.variants(model)).toEqual({ + none: { reasoningEffort: "none" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" }, }) @@ -2587,11 +2590,29 @@ describe("ProviderTransform.variants", () => { }, }) expect(ProviderTransform.variants(model)).toEqual({ + none: { reasoning: { enabled: false } }, high: { reasoning: { effort: "high" } }, xhigh: { reasoning: { effort: "xhigh" } }, }) }) + test("glm-5.2 returns effort variants for the kilo gateway", () => { + const model = createMockModel({ + id: "kilo/z-ai/glm-5.2", + providerID: "kilo", + api: { + id: "z-ai/glm-5.2", + url: "https://gateway.kilo.ai", + npm: "@kilocode/kilo-gateway", + }, + }) + expect(ProviderTransform.variants(model)).toEqual({ + none: { reasoning: { enabled: false, effort: "none" } }, + high: { reasoning: { enabled: true, effort: "high" } }, + xhigh: { reasoning: { enabled: true, effort: "xhigh" } }, + }) + }) + test("glm-5.2 returns effort variants for anthropic-compatible providers", () => { const model = createMockModel({ id: "zai-coding-plan/glm-5.2", @@ -2603,6 +2624,7 @@ describe("ProviderTransform.variants", () => { }, }) expect(ProviderTransform.variants(model)).toEqual({ + none: { thinking: { type: "disabled" } }, high: { effort: "high" }, max: { effort: "max" }, })