feat(minimax): extract M3 reasoning_content on OpenAI tiers - #6073
diegosouzapw merged 2 commits into
Conversation
…at tiers MiniMax M3 is registered with format:"openai" on 8 provider tiers (trae, huggingchat, bazaarlink, ollama-cloud, opencode, cline, opencode-zen, codebuddy-cn), where its raw <think>...</think> tags leaked directly into `content` instead of surfacing as a separate `reasoning_content` field. OmniRoute already has the extraction primitive (extractThinkingFromContent in responseSanitizer/reasoning.ts); it was just gated to deepseek-r1/r1-distill/qwq. Extend the allowlist (isTextualReasoningTagNativeRoute) with a minimax-m3-only pattern, excluding the two direct minimax/minimax-cn tiers, which stay on Anthropic's Messages format (targetFormat: "claude") and already surface reasoning natively. Co-authored-by: zmf963 <19422469+zmf963@users.noreply.github.com> Inspired-by: decolua/9router#2231
There was a problem hiding this comment.
Code Review
This pull request adds support for parsing and extracting textual reasoning tags (...) from MiniMax M3 models on OpenAI-format provider tiers (such as trae and huggingchat) while ensuring direct minimax and minimax-cn tiers remain unaffected. Comprehensive unit tests and regression guards are also added. The reviewer suggested a robust improvement to check if the providerId starts with "minimax" rather than checking for specific hardcoded provider IDs, which makes the exclusion logic future-proof.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // opencode, cline, opencode-zen, codebuddy-cn). The direct minimax/minimax-cn | ||
| // tiers stay on Anthropic's Messages format (targetFormat: "claude") and | ||
| // already surface reasoning natively, so they are excluded here. | ||
| (providerId !== "minimax" && providerId !== "minimax-cn" && /minimax[-_]?m3\b/.test(routeId)) |
There was a problem hiding this comment.
To make the exclusion of direct MiniMax provider tiers more robust and future-proof (e.g., if direct tiers like minimax-us or minimax-eu are introduced in the future), we can check if providerId starts with "minimax" instead of hardcoding individual provider IDs.
| (providerId !== "minimax" && providerId !== "minimax-cn" && /minimax[-_]?m3\b/.test(routeId)) | |
| (!providerId.startsWith("minimax") && /minimax[-_]?m3\b/.test(routeId)) |
1f6ec5b
into
diegosouzapw:release/v3.8.44
…iegosouzapw#6073) MiniMax M3 leaks raw <think>...</think> into content on 8 OpenAI-format provider tiers; extract it into reasoning_content, leaving the direct minimax/minimax-cn (Claude-format) tiers untouched. Replacement for the stale diegosouzapw#5804 branch. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
Replacement for #5804 because the original PR branch is stale/conflicting and I do not have permission to update
diegosouzapw:feat/port-pr-2231-minimax-m3-reasoningdirectly.This replays the actual MiniMax M3 feature commit onto current
release/v3.8.44as a narrow 3-file patch:CHANGELOG.mdopen-sse/handlers/responseSanitizer/reasoning.tstests/unit/responsesanitizer-reasoning-split.test.tsValidation run locally after rebasing onto current release:
npm exec --yes tsx -- --test tests/unit/responsesanitizer-reasoning-split.test.ts tests/unit/role-normalizer.test.ts npm run check:docs-sync npm run check:test-discoveryResults: