fix(providers): minimax-m3 collapses manual thinking.type:enabled to adaptive (#12132) (#13249)

Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit.

Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them.

- ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on #13243)
- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK
- complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline
- 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs
- `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for #13278 and #13276, annotated and landed on #13243

⚠️ base-red inherited: #12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-09-11 22:04:57 -03:00
committed by GitHub
parent 10099d037f
commit 480b190fdc
3 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1 @@
- fix(providers): minimax-m3 now collapses manual thinking.type:"enabled" to adaptive, preventing upstream 400 (2013) (#12132)

View File

@@ -733,12 +733,16 @@ export const MODEL_SPECS: Record<string, ModelSpec> = {
// ── MiniMax M3 (1M context, 512K max output) ─────────────────────
// max output verified against MiniMax docs / OpenRouter / Artificial
// Analysis (Nov 2025 launch): 1,048,576-token context, up to 512K output.
// Adaptive-thinking-only: MiniMax rejects manual budget_tokens /
// thinking.type:"enabled" with 400 (2013) — "invalid thinking.type:
// \"enabled\" (allowed: adaptive, disabled)" (#12132).
"minimax-m3": {
maxOutputTokens: 512000,
contextWindow: 1048576,
thinkingBudgetCap: 32768,
supportsThinking: true,
supportsTools: true,
adaptiveThinkingOnly: true,
aliases: ["MiniMax-M3", "MiniMaxAI/MiniMax-M3"],
},

View File

@@ -0,0 +1,48 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { isAdaptiveThinkingOnly } from "@/shared/constants/modelSpecs.ts";
import { normalizeClaudeAdaptiveThinking } from "@omniroute/open-sse/services/claudeAdaptiveThinking.ts";
// Issue #12132: MiniMax M3 rejects thinking.type:"enabled" with 400 (2013)
// ("invalid thinking.type: \"enabled\" (allowed: adaptive, disabled)"), but the
// modelSpecs entry for minimax-m3 was never given `adaptiveThinkingOnly: true`
// (the change #9155 proposed and claimed to have landed). Because every
// normalization site that would collapse `enabled` -> `adaptive` gates on
// `isAdaptiveThinkingOnly()`, a manual thinking.type:"enabled" request that
// resolves to MiniMax M3 (via either the `minimax` or `minimax-cn` provider,
// since both alias to the same spec entry) was forwarded unchanged and
// upstream 400s.
test("minimax-m3 is flagged adaptiveThinkingOnly so manual thinking.type is collapsed", () => {
assert.equal(
isAdaptiveThinkingOnly("minimax-m3"),
true,
"minimax-m3 modelSpec is missing adaptiveThinkingOnly: true"
);
assert.equal(
isAdaptiveThinkingOnly("MiniMax-M3"),
true,
"MiniMax-M3 alias must resolve to the same adaptive-thinking-only spec"
);
});
test("normalizeClaudeAdaptiveThinking collapses enabled->adaptive for MiniMax M3", () => {
const body = {
thinking: { type: "enabled", budget_tokens: 20000 },
output_config: { effort: "max" },
};
const result = normalizeClaudeAdaptiveThinking(body, "MiniMax-M3");
assert.equal(
(result.thinking as Record<string, unknown>).type,
"adaptive",
"thinking.type:\"enabled\" must be collapsed to \"adaptive\" for MiniMax M3, " +
"otherwise upstream rejects it with 400 (2013)"
);
assert.equal(
(result.thinking as Record<string, unknown>).budget_tokens,
undefined,
"budget_tokens must be dropped once thinking is collapsed to adaptive"
);
});