Skip to content

fix(model): handle minimax m3#1771

Merged
zerob13 merged 2 commits into
devfrom
codex/minimax-model-matching
Jun 16, 2026
Merged

fix(model): handle minimax m3#1771
zerob13 merged 2 commits into
devfrom
codex/minimax-model-matching

Conversation

@zerob13

@zerob13 zerob13 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Fixed MiniMax provider configuration lookup to correctly match model/provider IDs regardless of letter casing.
  • New Features
    • Improved MiniMax M3 defaults, including a guaranteed minimum context length and forcing interleaved thinking compatibility.
    • Added MiniMax M3 adaptive thinking support for Anthropic-compatible runtimes when reasoning is enabled (and omits it when reasoning is disabled).
  • Documentation
    • Published a spec and rollout plan for the MiniMax model configuration behavior and acceptance criteria.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc17688f-be97-420c-a6dd-010f7ea1d628

📥 Commits

Reviewing files that changed from the base of the PR and between f1069d2 and dc36aa5.

📒 Files selected for processing (3)
  • docs/issues/minimax-model-matching/spec.md
  • src/main/presenter/configPresenter/modelConfig.ts
  • test/main/presenter/providerDbModelConfig.test.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/issues/minimax-model-matching/spec.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/main/presenter/providerDbModelConfig.test.ts
  • src/main/presenter/configPresenter/modelConfig.ts

📝 Walkthrough

Walkthrough

Fixes MiniMax model ID matching by normalizing provider DB candidate IDs (stripping models/ prefix and lowercasing) in ModelConfigHelper. Adds MiniMax-M3 specific defaults: a context-length floor and forced forceInterleavedThinkingCompat. Extends the Anthropic-compatible provider options mapper to emit { type: 'adaptive' } thinking for MiniMax-M3 when reasoning is enabled. Includes tests and issue docs.

Changes

MiniMax model matching and adaptive thinking

Layer / File(s) Summary
Issue spec, plan, and tasks docs
docs/issues/minimax-model-matching/spec.md, docs/issues/minimax-model-matching/plan.md, docs/issues/minimax-model-matching/tasks.md
Three new markdown files define the problem (mixed-case model IDs failing case-sensitive provider DB lookup), acceptance criteria (case-insensitive DB lookup, MiniMax-M3 interleaved thinking, adaptive thinking when reasoning enabled), implementation plan, and completed task checklist.
ModelConfigHelper: case-insensitive matching and MiniMax-M3 defaults
src/main/presenter/configPresenter/modelConfig.ts, test/main/presenter/providerDbModelConfig.test.ts
Introduces MINIMAX_M3_CONTEXT_LENGTH, isMiniMaxProvider, isMiniMaxM3Model, and normalizeProviderDbModelId helpers. Applies lowercase normalization (and models/ prefix stripping) when comparing candidate IDs in both the resolved-provider and fallback search paths. Computes contextLength with the M3 floor and sets forceInterleavedThinkingCompat: true for M3. Tests add a mocked MiniMax provider with MiniMax-M2.5 and MiniMax-M3 entries, a case-insensitive lookup assertion, and a stale-cache M3 defaults assertion covering vision, function-call, and reasoning capability flags.
providerOptionsMapper: MiniMax-M3 adaptive thinking
src/main/presenter/llmProviderPresenter/aiSdk/providerOptionsMapper.ts, test/main/presenter/llmProviderPresenter/aiSdkProviderOptionsMapper.test.ts
Adds normalizeMinimaxModelId and isMiniMaxM3Request helpers. In the anthropic/bedrock provider-options branch, inserts an else if that sets config.thinking = { type: 'adaptive' } for qualifying MiniMax-M3 requests when reasoning is enabled. Tests cover the reasoning-enabled (adaptive thinking emitted) and reasoning-disabled (only toolStreaming: false) cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#1449: Both PRs modify providerOptionsMapper.ts to extend buildProviderOptions, with this PR adding MiniMax-M3 adaptive thinking normalization on top of the existing AI-SDK runtime mapper work.
  • ThinkInAIXYZ/deepchat#956: Both PRs modify modelConfig.ts to change how provider/model IDs are matched in provider DB lookups, with this PR adding case-insensitive normalization on top of earlier DB-driven capability lookup logic.

Poem

🐇 Hoppity hop through the model name maze,
Mixed-case MiniMax had me in a daze!
I lowercased the IDs, stripped "models/" away,
And set adaptive thinking for reasoning's day.
Now M3 defaults to interleaved thought—
A case-insensitive fix, cleanly wrought! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(model): handle minimax m3' is directly related to the main changes in the changeset, which focus on implementing MiniMax M3 model handling including provider DB matching fixes and adaptive thinking support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/minimax-model-matching

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/issues/minimax-model-matching/spec.md`:
- Around line 5-7: The compound modifier in the documentation is missing proper
hyphenation for readability. Change "provider DB derived configuration" to
"provider DB-derived configuration" by adding a hyphen between "DB" and
"derived" to properly format the compound modifier that describes the
configuration type.

In `@src/main/presenter/configPresenter/modelConfig.ts`:
- Around line 195-201: The MiniMax-M3 context floor computed at the
isMiniMaxM3Model check is being silently overridden by stale provider cache
values during the merge at the provider source preference logic (line 534).
Ensure that when merging provider-specific configurations, the M3 context floor
is not bypassed by cached values. Either prevent the storedConfig.contextLength
preference from applying to M3 models, or reapply the M3 floor constraint after
the provider cache merge in the applyProviderSpecificPolicies method to
guarantee the floor remains intact regardless of cached state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e78a84d2-df21-44c5-95b5-0a59785d22b0

📥 Commits

Reviewing files that changed from the base of the PR and between 8cf9835 and f1069d2.

📒 Files selected for processing (7)
  • docs/issues/minimax-model-matching/plan.md
  • docs/issues/minimax-model-matching/spec.md
  • docs/issues/minimax-model-matching/tasks.md
  • src/main/presenter/configPresenter/modelConfig.ts
  • src/main/presenter/llmProviderPresenter/aiSdk/providerOptionsMapper.ts
  • test/main/presenter/llmProviderPresenter/aiSdkProviderOptionsMapper.test.ts
  • test/main/presenter/providerDbModelConfig.test.ts

Comment thread docs/issues/minimax-model-matching/spec.md
Comment on lines +195 to +201
const contextLimit = isMiniMaxM3Model(providerId, model.id)
? Math.max(model.limit?.context ?? 0, MINIMAX_M3_CONTEXT_LENGTH)
: model.limit?.context

return this.applyProviderSpecificPolicies(providerId, model.id, {
maxTokens: resolveDerivedModelMaxTokens(model.limit?.output),
contextLength: resolveModelContextLength(model.limit?.context),
contextLength: resolveModelContextLength(contextLimit),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

MiniMax-M3 context floor can be silently bypassed by provider cache merge.

You compute the M3 floor here, but Line 534 later prefers storedConfig.contextLength for source: 'provider' entries. A stale provider cache value (e.g., 512000) will override the new 1_000_000 minimum and break the intended fallback behavior.

Proposed fix
-        contextLength: storedConfig.contextLength ?? finalConfig.contextLength,
+        contextLength:
+          isMiniMaxM3Model(providerId, modelId)
+            ? Math.max(
+                storedConfig.contextLength ?? 0,
+                finalConfig.contextLength ?? MINIMAX_M3_CONTEXT_LENGTH
+              )
+            : storedConfig.contextLength ?? finalConfig.contextLength,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/presenter/configPresenter/modelConfig.ts` around lines 195 - 201,
The MiniMax-M3 context floor computed at the isMiniMaxM3Model check is being
silently overridden by stale provider cache values during the merge at the
provider source preference logic (line 534). Ensure that when merging
provider-specific configurations, the M3 context floor is not bypassed by cached
values. Either prevent the storedConfig.contextLength preference from applying
to M3 models, or reapply the M3 floor constraint after the provider cache merge
in the applyProviderSpecificPolicies method to guarantee the floor remains
intact regardless of cached state.

@zerob13 zerob13 merged commit 39bebe9 into dev Jun 16, 2026
3 checks passed
@zhangmo8 zhangmo8 deleted the codex/minimax-model-matching branch June 16, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant