-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(providers): calibrate and expand Command Code model reasoning effort ladders #5952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
codingbooo
wants to merge
1
commit into
lidge-jun:dev
from
codingbooo:fix/issue-5096-command-code-efforts
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { afterEach, expect, test } from "bun:test"; | ||
| import { createCommandCodeAdapter } from "../../src/adapters/command-code"; | ||
| import { commandCodeReasoningEfforts, refreshCommandCodeReasoningEfforts, resetCommandCodeReasoningEffortsForTest } from "../../src/providers/command-code-efforts"; | ||
| import { PROVIDER_REGISTRY } from "../../src/providers/registry"; | ||
| import type { OcxParsedRequest } from "../../src/types"; | ||
|
|
||
| // Issue #5096: measured accepted ladders, including the narrower exceptions. | ||
| const measured: Array<[string, string[]]> = [ | ||
| ["deepseek/deepseek-v4.1-flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["deepseek/deepseek-v4-flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["deepseek/deepseek-v4-flash-vision-exp", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["z-ai/glm-5.3-flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["zai-org/GLM-5.3", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["Qwen/Qwen3.8-Flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["google/gemini-3.7-flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["moonshotai/Kimi-K3", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["MiniMaxAI/MiniMax-M3", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["xiaomi/mimo-v2.5", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["xai/grok-4.5", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["xai/grok-4.6", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["tencent/hy3-paid", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["tencent/hy4-preview", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["stepfun/Step-3.7-Flash", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["Qwen/Qwen3.8-Max", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["Qwen/Qwen3.8-27B", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["meta/muse-spark-1.2-contributor", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["meta/muse-spark-1.3-contributor", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["nvidia/nemotron-3-ultra-550b-a55b", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["meituan/LongCat-2.0:free", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["inclusionai/ling-3.0-flash-sante:free", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["thinkingmachines/inkling-small", ["low", "medium", "high", "xhigh", "max"]], | ||
| ["moonshotai/Kimi-K2.7-Code", ["low", "medium", "high", "xhigh"]], | ||
| ["moonshotai/Kimi-K2.7-Code-Highspeed", ["low", "high", "xhigh", "max"]], | ||
| ["xiaomi/mimo-v2.5-pro", ["low", "medium", "high"]], | ||
| ["Qwen/Qwen3.7-32B", ["low", "medium", "high", "xhigh"]], | ||
| ["Qwen/Qwen3.7-72B", ["low", "medium", "high", "xhigh"]], | ||
| ["Qwen/Qwen3.6-35B-A22B", ["low", "medium", "high", "xhigh"]], | ||
| ["poolside/laguna-s-2.1-free", ["medium"]], | ||
| ["google/gemini-3.8-flash", ["low", "medium", "high"]], | ||
| ]; | ||
|
|
||
| const adapter = createCommandCodeAdapter({ adapter: "command-code", baseUrl: "https://api.commandcode.ai", apiKey: "synthetic-command-key" }); | ||
| function request(modelId: string, reasoning: string): OcxParsedRequest { | ||
| return { modelId, stream: true, context: { systemPrompt: [], messages: [], tools: [] }, | ||
| options: { reasoning, maxOutputTokens: 100 } }; | ||
| } | ||
| afterEach(() => resetCommandCodeReasoningEffortsForTest()); | ||
|
|
||
| test.each(measured)("%s exposes and forwards every measured effort", async (modelId, ladder) => { | ||
| expect(commandCodeReasoningEfforts(modelId)).toEqual(ladder); | ||
| expect(commandCodeReasoningEfforts(modelId.toUpperCase())).toEqual(ladder); | ||
| for (const id of ["command-code", "commandcode"]) { | ||
| expect(PROVIDER_REGISTRY.find(entry => entry.id === id)?.modelReasoningEfforts?.[modelId]).toEqual(ladder); | ||
| } | ||
| for (const effort of ladder) { | ||
| const built = await adapter.buildRequest(request(modelId, effort)); | ||
| expect(JSON.parse(built.body).params.reasoning_effort).toBe(effort); | ||
| } | ||
| for (const effort of ["low", "medium", "high", "xhigh", "max"]) { | ||
| if (ladder.includes(effort)) continue; | ||
| const built = await adapter.buildRequest(request(modelId, effort)); | ||
| expect(JSON.parse(built.body).params).not.toHaveProperty("reasoning_effort"); | ||
| } | ||
| }); | ||
|
|
||
| test("a measured row without a profile remembers rejections without guessing a URL", async () => { | ||
| const model = "moonshotai/Kimi-K3"; | ||
| let calls = 0; | ||
| const fetch = async () => { calls++; return new Response("", { status: 404 }); }; | ||
| expect(await refreshCommandCodeReasoningEfforts(model, fetch, "max")).toBeUndefined(); | ||
| expect(calls).toBe(0); | ||
| expect(commandCodeReasoningEfforts(model)).toEqual(["low", "medium", "high", "xhigh"]); | ||
| const built = await adapter.buildRequest(request(model, "max")); | ||
| expect(JSON.parse(built.body).params).not.toHaveProperty("reasoning_effort"); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Return the filtered ladder for a profile-free row.
If Command Code rejects an effort on a new row without
profileUrl, Line 311 returnsundefinedafter recording the rejection. Insrc/adapters/command-code.ts,fetchResponseretries without the effort only when refresh returns a ladder that excludes it. The first request therefore fails with the upstream rejection. Later requests omit the effort because the rejection was recorded. ReturncommandCodeReasoningEfforts(modelId, destination)for a profile-free row so the existing recovery path can retry the first request. Add a test forfetchResponseafter an upstream effort rejection, not only for the laterbuildRequestcall. As per coding guidelines, “Optional integrations must degrade through the existing failure representation rather than crash the request path.”🤖 Prompt for AI Agents
Source: Coding guidelines