Skip to content

Commit 018a562

Browse files
fix(models): preserve GLM effort policy
Keep the portable policy aligned with the existing desktop model configuration when mobile adopts it. Generated-By: PostHog Code Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
1 parent 88a0684 commit 018a562

3 files changed

Lines changed: 38 additions & 24 deletions

File tree

packages/shared/src/cloud-task-models.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,17 @@ describe("buildCloudTaskConfigOptions", () => {
153153
{ value: "@cf/zai-org/glm-5.2" },
154154
],
155155
},
156+
{
157+
id: "effort",
158+
currentValue: "high",
159+
options: [{ value: "high" }, { value: "max" }],
160+
},
161+
]);
162+
expect(options.map((option) => option.id)).toEqual([
163+
"mode",
164+
"model",
165+
"effort",
156166
]);
157-
expect(options.map((option) => option.id)).toEqual(["mode", "model"]);
158167
});
159168

160169
it("builds Codex options with the shared default and reasoning levels", () => {

packages/shared/src/reasoning-effort.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ describe("isSupportedReasoningEffort", () => {
88
["codex", "gpt-5.4", "max", false],
99
["claude", "claude-opus-4-8", "xhigh", true],
1010
["claude", "claude-sonnet-4-6", "xhigh", false],
11+
["claude", "@cf/zai-org/glm-5.2", "high", true],
12+
["claude", "@cf/zai-org/glm-5.2", "max", true],
13+
["claude", "@cf/zai-org/glm-5.2", "medium", false],
1114
["claude", "claude-opus-4-8", "minimal", false],
1215
] as const)(
1316
"validates %s %s effort %s",

packages/shared/src/reasoning-effort.ts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,46 @@ const BASE_OPTIONS: ReasoningEffortOption[] = [
2020
{ value: "high", name: "High" },
2121
];
2222

23-
const CLAUDE_MODELS_WITH_EFFORT = new Set([
24-
"claude-opus-4-7",
25-
"claude-opus-4-8",
26-
"claude-sonnet-4-6",
27-
"claude-sonnet-5",
28-
"claude-fable-5",
29-
]);
23+
const CLAUDE_MODEL_EFFORTS: Readonly<
24+
Record<string, readonly SupportedReasoningEffort[]>
25+
> = {
26+
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
27+
"claude-opus-4-8": ["low", "medium", "high", "xhigh", "max"],
28+
"claude-sonnet-4-6": ["low", "medium", "high"],
29+
"claude-sonnet-5": ["low", "medium", "high", "xhigh", "max"],
30+
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
31+
"@cf/zai-org/glm-5.2": ["high", "max"],
32+
};
3033

31-
const CLAUDE_MODELS_WITH_XHIGH_EFFORT = new Set([
32-
"claude-opus-4-7",
33-
"claude-opus-4-8",
34-
"claude-sonnet-5",
35-
"claude-fable-5",
36-
]);
34+
const EFFORT_NAMES: Record<SupportedReasoningEffort, string> = {
35+
low: "Low",
36+
medium: "Medium",
37+
high: "High",
38+
xhigh: "Extra High",
39+
max: "Max",
40+
};
3741

3842
export function getReasoningEffortOptions(
3943
adapter: Adapter,
4044
modelId: string,
4145
): ReasoningEffortOption[] | null {
42-
if (adapter === "claude" && !CLAUDE_MODELS_WITH_EFFORT.has(modelId)) {
43-
return null;
46+
if (adapter === "claude") {
47+
const efforts = CLAUDE_MODEL_EFFORTS[modelId];
48+
return (
49+
efforts?.map((value) => ({ value, name: EFFORT_NAMES[value] })) ?? null
50+
);
4451
}
4552

4653
const options = [...BASE_OPTIONS];
4754
const normalizedModelId = modelId.toLowerCase();
4855
const supportsXhigh =
49-
adapter === "claude"
50-
? CLAUDE_MODELS_WITH_XHIGH_EFFORT.has(modelId)
51-
: normalizedModelId.includes("gpt-5.5") ||
52-
normalizedModelId.includes("gpt-5.6");
56+
normalizedModelId.includes("gpt-5.5") ||
57+
normalizedModelId.includes("gpt-5.6");
5358

5459
if (supportsXhigh) {
5560
options.push({ value: "xhigh", name: "Extra High" });
5661
}
57-
if (
58-
(adapter === "claude" && supportsXhigh) ||
59-
(adapter === "codex" && normalizedModelId.includes("gpt-5.6"))
60-
) {
62+
if (adapter === "codex" && normalizedModelId.includes("gpt-5.6")) {
6163
options.push({ value: "max", name: "Max" });
6264
}
6365

0 commit comments

Comments
 (0)