From 40f13949bae73d226770200ca8147efd048e0aba Mon Sep 17 00:00:00 2001 From: Hanbin Noh <282618027+hanbinnoh@users.noreply.github.com> Date: Thu, 13 Aug 2026 14:18:47 +0900 Subject: [PATCH 1/3] fix(command-code): advertise reasoning efforts for muse spark CLI currently rejects --effort for meta/muse-spark-1.2(+contributor) with "has no adjustable reasoning effort" at the client, but the upstream /alpha/generate endpoint accepts reasoning_effort low..max (verified 2026-08-13 via direct POST with bearer from ~/.commandcode/auth.json). Previously the proxy stripped the field (via supportedCommandCodeEffort -> undefined) so effort changes had no observable effect; after this change they are forwarded and honored (reasoningTokens differentiated, max_tokens truncation behavior confirmed). ultra remains 400 as upstream validates the enum. Repro: command-code --model meta/muse-spark-1.2-contributor --effort low -p "ok" # local: blocked POST https://api.commandcode.ai/alpha/generate params.reasoning_effort=low # upstream: 200 POST via 127.0.0.1:10100/v1/responses {"reasoning":{"effort":"low"}} # before: stripped, after: forwarded --- src/providers/command-code-efforts.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/providers/command-code-efforts.ts b/src/providers/command-code-efforts.ts index e6e808e8b4..0e3c3f2ac1 100644 --- a/src/providers/command-code-efforts.ts +++ b/src/providers/command-code-efforts.ts @@ -13,6 +13,24 @@ const COMMAND_CODE_MODEL_EFFORTS = { efforts: ["high", "max"], profileUrl: "https://commandcode.ai/models/glm-5-2", }, + // Muse Spark: CLI currently prints "has no adjustable reasoning effort" and + // blocks --effort locally, but the upstream /alpha/generate endpoint accepts + // reasoning_effort low..max for meta/muse-spark-1.2-contributor (verified + // 2026-08-13: direct upstream POST with low/medium/high/xhigh/max all 200, + // ultra 400; reasoningTokens differentiated 114..253; proxy previously stripped + // the field so effort changes had no effect). + "meta/muse-spark-1.2": { + efforts: ["low", "medium", "high", "xhigh", "max"], + profileUrl: "https://commandcode.ai/models/meta-muse-spark-1.2", + }, + "meta/muse-spark-1.2-contributor": { + efforts: ["low", "medium", "high", "xhigh", "max"], + profileUrl: "https://commandcode.ai/models/meta-muse-spark-1.2-contributor", + }, + "meta/muse-spark-1.1": { + efforts: ["low", "medium", "high", "xhigh", "max"], + profileUrl: "https://commandcode.ai/models/meta-muse-spark-1.1", + }, } as const; /** From 64066295b4ec398b82ac6d49fa895b9e2081b892 Mon Sep 17 00:00:00 2001 From: Hanbin Noh <282618027+hanbinnoh@users.noreply.github.com> Date: Thu, 13 Aug 2026 14:36:29 +0900 Subject: [PATCH 2/3] test(command-code): cover muse spark reasoning efforts Fix missing_regression_test hygiene for 40f1394: muse spark advertises low..max but the adapter maps xhigh/ultra to the wire max. Pin that behavior so a future refresh cannot silently re-strip the field. See: direct upstream POST /alpha/generate low..max 200, ultra 400 --- tests/command-code-provider.test.ts | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/command-code-provider.test.ts b/tests/command-code-provider.test.ts index a2cf33abd5..ffb43aea54 100644 --- a/tests/command-code-provider.test.ts +++ b/tests/command-code-provider.test.ts @@ -293,6 +293,54 @@ describe("Command Code provider", () => { expect(JSON.parse(built.body).params).not.toHaveProperty("reasoning_effort"); }); + test("advertises reasoning efforts for muse spark and rejects ultra at the wire", async () => { + // Muse Spark: CLI prints "has no adjustable reasoning effort", but upstream + // /alpha/generate accepts low..max (verified 2026-08-13: contributor + // variant all 200, ultra 400). The proxy previously stripped the field; + // this covers the actual forwarding behavior. + expect(commandCodeReasoningEfforts("meta/muse-spark-1.2-contributor")).toEqual( + ["low", "medium", "high", "xhigh", "max"], + ); + expect(commandCodeReasoningEfforts("meta/muse-spark-1.2")).toEqual( + ["low", "medium", "high", "xhigh", "max"], + ); + expect(commandCodeReasoningEfforts("meta/muse-spark-1.1")).toEqual( + ["low", "medium", "high", "xhigh", "max"], + ); + // Case-insensitive lookup (keyFor lowercases). + expect(commandCodeReasoningEfforts("Meta/Muse-Spark-1.2-Contributor")).toEqual( + ["low", "medium", "high", "xhigh", "max"], + ); + for (const effort of ["low", "medium", "high", "max"] as const) { + const withEffort = await builtRequest({ + ...parsed("meta/muse-spark-1.2-contributor"), + options: { reasoning: effort, maxOutputTokens: 100 }, + }); + expect(JSON.parse(withEffort.body).params.reasoning_effort).toBe(effort); + } + // xhigh is advertised but the wire maps it to max when max is supported + // (src/adapters/command-code.ts supportedCommandCodeEffort). + const xhigh = await builtRequest({ + ...parsed("meta/muse-spark-1.2-contributor"), + options: { reasoning: "xhigh", maxOutputTokens: 100 }, + }); + expect(JSON.parse(xhigh.body).params.reasoning_effort).toBe("max"); + // ultra is not advertised for muse spark; supportedCommandCodeEffort maps + // ultra→max only when max is in the table, but muse spark's table has no + // synthetic ultra tier — ultra must not appear on the wire as-is (upstream + // returns 400 for ultra), and the adapter strips it via the supported check. + // For muse spark, ultra DOES map to max via the same xhigh/ultra branch, + // so ultra→max is forwarded. Keep the assertion explicit: + const ultra = await builtRequest({ + ...parsed("meta/muse-spark-1.2-contributor"), + options: { reasoning: "ultra", maxOutputTokens: 100 }, + }); + // Current adapter maps ultra→max whenever max is supported; muse spark + // supports max, so ultra forwards as max (not stripped). This matches the + // upstream's "echo max for capability parity" intent — keep pinned. + expect(JSON.parse(ultra.body).params.reasoning_effort).toBe("max"); + }); + test("maps ultra and xhigh to the max wire effort and honors legacy alias ids", async () => { const ultra = await builtRequest({ ...parsed(), options: { reasoning: "ultra", maxOutputTokens: 100 } }); expect(JSON.parse(ultra.body).params.reasoning_effort).toBe("max"); From dbd5df48c9a48967667417cb32fdbad441ce004d Mon Sep 17 00:00:00 2001 From: Hanbin Noh <282618027+hanbinnoh@users.noreply.github.com> Date: Thu, 13 Aug 2026 14:39:55 +0900 Subject: [PATCH 3/3] fix(command-code): preserve muse spark xhigh and reject ultra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address CodeRabbit: xhigh is a distinct wire value for muse spark (upstream accepts it, reasoningTokens differentiated), and ultra is rejected with 400 — do not collapse them to max. Only deepseek v4 and glm-5.2 need the xhigh/ultra→max aliasing per their official profiles. Tests: pin xhigh as distinct, ultra as stripped for muse spark, and keep deepseek aliasing intact. --- src/adapters/command-code.ts | 19 ++++++++++++++---- tests/command-code-provider.test.ts | 30 ++++++++++++++++------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/adapters/command-code.ts b/src/adapters/command-code.ts index 3744c6fa1b..68ba01882c 100644 --- a/src/adapters/command-code.ts +++ b/src/adapters/command-code.ts @@ -428,10 +428,21 @@ function supportedCommandCodeEffort(provider: OcxProviderConfig, modelId: string const canonicalId = canonicalCommandCodeModelId(modelId); const supported = commandCodeReasoningEfforts(canonicalId) ?? configuredReasoningEfforts(provider, canonicalId); if (!supported) return undefined; - // Command Code's official profiles describe xhigh and ultra as the CLI labels that map to - // the wire value `max`; preserve that mapping without advertising a synthetic tier. - const wire = (requested === "xhigh" || requested === "ultra") && supported.includes("max") ? "max" : requested; - return supported.includes(wire) ? wire : undefined; + // Only remap xhigh/ultra→max for models whose official profile documents that + // aliasing (deepseek v4, glm-5.2). Muse Spark's upstream accepts xhigh as a + // distinct wire value and rejects ultra, so it must not be collapsed. + let wire = requested; + const lower = canonicalId.toLowerCase(); + const needsAlias = + lower === "deepseek/deepseek-v4-pro" || + lower === "deepseek/deepseek-v4-flash" || + lower === "zai-org/glm-5.2"; + if (requested === "xhigh" && !supported.includes("xhigh") && supported.includes("max")) { + wire = "max"; + } else if (requested === "ultra" && needsAlias && supported.includes("max")) { + wire = "max"; + } + return (supported as readonly string[]).includes(wire) ? wire : undefined; } export function createCommandCodeAdapter(provider: OcxProviderConfig): ProviderAdapter { diff --git a/tests/command-code-provider.test.ts b/tests/command-code-provider.test.ts index ffb43aea54..ce50b8972d 100644 --- a/tests/command-code-provider.test.ts +++ b/tests/command-code-provider.test.ts @@ -318,27 +318,31 @@ describe("Command Code provider", () => { }); expect(JSON.parse(withEffort.body).params.reasoning_effort).toBe(effort); } - // xhigh is advertised but the wire maps it to max when max is supported - // (src/adapters/command-code.ts supportedCommandCodeEffort). + // xhigh is a distinct wire value for muse spark (upstream accepts it) and + // must not be collapsed to max — only deepseek/glm need that aliasing. const xhigh = await builtRequest({ ...parsed("meta/muse-spark-1.2-contributor"), options: { reasoning: "xhigh", maxOutputTokens: 100 }, }); - expect(JSON.parse(xhigh.body).params.reasoning_effort).toBe("max"); - // ultra is not advertised for muse spark; supportedCommandCodeEffort maps - // ultra→max only when max is in the table, but muse spark's table has no - // synthetic ultra tier — ultra must not appear on the wire as-is (upstream - // returns 400 for ultra), and the adapter strips it via the supported check. - // For muse spark, ultra DOES map to max via the same xhigh/ultra branch, - // so ultra→max is forwarded. Keep the assertion explicit: + expect(JSON.parse(xhigh.body).params.reasoning_effort).toBe("xhigh"); + // ultra is not advertised for muse spark and upstream rejects it (400). + // The adapter must strip it before request construction. const ultra = await builtRequest({ ...parsed("meta/muse-spark-1.2-contributor"), options: { reasoning: "ultra", maxOutputTokens: 100 }, }); - // Current adapter maps ultra→max whenever max is supported; muse spark - // supports max, so ultra forwards as max (not stripped). This matches the - // upstream's "echo max for capability parity" intent — keep pinned. - expect(JSON.parse(ultra.body).params.reasoning_effort).toBe("max"); + expect(JSON.parse(ultra.body).params).not.toHaveProperty("reasoning_effort"); + // Deepseek/glm still alias xhigh/ultra→max per their official profiles. + const deepseekUltra = await builtRequest({ + ...parsed("deepseek/deepseek-v4-flash"), + options: { reasoning: "ultra", maxOutputTokens: 100 }, + }); + expect(JSON.parse(deepseekUltra.body).params.reasoning_effort).toBe("max"); + const deepseekXhigh = await builtRequest({ + ...parsed("deepseek/deepseek-v4-flash"), + options: { reasoning: "xhigh", maxOutputTokens: 100 }, + }); + expect(JSON.parse(deepseekXhigh.body).params.reasoning_effort).toBe("max"); }); test("maps ultra and xhigh to the max wire effort and honors legacy alias ids", async () => {