fix(model_metadata): override models.dev underreports for MiniMax-M3 - #38298
Closed
semperaug wants to merge 1 commit into
Closed
fix(model_metadata): override models.dev underreports for MiniMax-M3#38298semperaug wants to merge 1 commit into
semperaug wants to merge 1 commit into
Conversation
get_model_context_length() step 5f consults models.dev BEFORE the
hardcoded DEFAULT_CONTEXT_LENGTHS fallback. models.dev still lists
MiniMax-M3's context as 512,000 (the catalog hasn't been updated
since the 2026-06-01 release) — so the hardcoded 1M entry at
'minimax-m3' is never reached and the TUI status bar shows
'64K/512K' instead of the true 1M window. M3's reasoning quality
degrades at the 50% mark because Hermes thinks it's already
half-full.
Two changes:
1. New hardcoded-override guard at step 5f: when models.dev returns
a value SMALLER than what DEFAULT_CONTEXT_LENGTHS has for the
same model, trust the hardcode and log. Same pattern as the
existing Kimi-family 32k guard at step 6 — generic, so future
newly-released models with stale catalog data get auto-fixed.
2. Widen the M3 stale-cache invalidation threshold at step 1 from
'<= 204,800' to '< 1,000,000' so existing sessions whose
context_compressor cached the 512K value get re-resolved on
the next lookup instead of staying stuck at the underreport.
Verified:
- get_model_context_length('MiniMax-M3', provider='minimax-cn')
returns 1,000,000 (was 512,000)
- Stale cache entry 512K gets invalidated and re-resolves to 1M
- 100 tests in tests/agent/test_model_metadata.py and
tests/test_minimax_model_validation.py pass
This was referenced Jun 10, 2026
Author
|
Superseded by upstream. The same fix has already landed on main through a series of commits that evolved past this approach:
Upstream's threshold-based probe + native provider registration + contract-based test is more robust than the hardcoded literal in this PR. Closing as |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
get_model_context_length()consultsmodels.dev(step 5f) before the hardcodedDEFAULT_CONTEXT_LENGTHSfallback (step 8). For newly-released models, models.dev lags behind on its catalog values —MiniMax-M3was released 2026-06-01 and models.dev still lists its context window as 512,000 tokens, when the official value is 1,000,000. The hardcodedminimax-m3: 1,000,000entry inDEFAULT_CONTEXT_LENGTHSis therefore never reached, and the TUI status bar displays64K/512Kinstead of the true64K/1M. Reasoning quality degrades around the 50% mark because Hermes thinks the context is already half-full.Changes
1. New hardcoded-override guard at step 5f (
agent/model_metadata.py:1721-1737)When models.dev returns a value smaller than what
DEFAULT_CONTEXT_LENGTHShas for the same model, trust the hardcode and log. Same pattern as the existing Kimi-family 32k guard at step 6 — generic, so future newly-released models with stale catalog data get auto-fixed without per-model special-casing.2. Widen the M3 stale-cache invalidation threshold at step 1 (
agent/model_metadata.py:1554-1566)From
<= 204,800to< 1,000,000so existing sessions whosecontext_compressorcached the 512K value get re-resolved on the next lookup instead of staying stuck at the underreport.3. New helper
_hardcoded_context_length_for()(agent/model_metadata.py:1781-1795)Extracts the longest-key-first fuzzy-match logic from step 8 into a reusable function so the new step 5f guard uses the exact same precedence rules as the hardcoded fallback.
Why this matters for users
X K / 1,000 Kfor M3 (wasX K / 512 K)Verification
tests/agent/test_model_metadata.pyandtests/test_minimax_model_validation.pypass ✓Related
MiniMax-M3official context: 1,000,000 tokens (https://platform.minimax.io/docs/api-reference/text-chat-openai, https://openrouter.ai/minimax/minimax-m3)minimax-cnprovider currently listsMiniMax-M3withlimit.context: 512,000(stale)