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.
This commit is contained in:
marius-kilocode
2026-07-03 14:02:53 +02:00
parent 0cd75205f6
commit 2d814cd652
3 changed files with 41 additions and 0 deletions
@@ -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.
@@ -669,21 +669,35 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
}
const adaptiveOpus = anthropicOpus47OrLater(model.api.id)
const adaptiveEfforts = anthropicAdaptiveEfforts(model.api.id)
if (glm52 && model.api.npm === "@kilocode/kilo-gateway") {
// kilocode_change - mirror the cloud's none/high/xhigh GLM-5.2 variants
// (see REASONING_VARIANTS_NONE_HIGH_XHIGH in cloud model-settings.ts) so the
// computed fallback matches the config the gateway pushes. Without this the
// generic GLM binary toggle (instant/thinking) below is used instead.
return {
none: { reasoning: { enabled: false, effort: "none" } },
high: { reasoning: { enabled: true, effort: "high" } },
xhigh: { reasoning: { enabled: true, effort: "xhigh" } },
}
}
if (glm52 && model.api.npm === "@openrouter/ai-sdk-provider") {
// OpenRouter maps xhigh to GLM-5.2's native max effort.
return {
none: { reasoning: { enabled: false } },
high: { reasoning: { effort: "high" } },
xhigh: { reasoning: { effort: "xhigh" } },
}
}
if (glm52 && model.api.npm === "@ai-sdk/openai-compatible") {
return {
none: { reasoningEffort: "none" },
high: { reasoningEffort: "high" },
max: { reasoningEffort: "max" },
}
}
if (glm52 && model.api.npm === "@ai-sdk/anthropic") {
return {
none: { thinking: { type: "disabled" } },
high: { effort: "high" },
max: { effort: "max" },
}
@@ -2539,6 +2539,7 @@ describe("ProviderTransform.variants", () => {
},
})
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" },
})