fix: prevent infinite auto-compact loop for unknown 3P models (#635) (#636)

- Raise context window fallback from 8k to 128k for unknown OpenAI-compat models.
  The 8k fallback caused effective context (8k minus output reservation) to go
  negative, making auto-compact fire on every single message.
- Add safety floor in getEffectiveContextWindowSize(): effective context is
  always at least reservedTokensForSummary + 13k buffer, ensuring the
  auto-compact threshold stays positive.
- Add missing MiniMax model entries (M2.5, M2.5-highspeed, M2.1, M2.1-highspeed)
  all at 204,800 context / 131,072 max output per MiniMax docs.
- Add tests for MiniMax variants, 128k fallback, and autoCompact floor.

Fixes #635

Co-authored-by: root <root@vm7508.lumadock.com>
This commit is contained in:
Vasanth T
2026-04-12 23:33:02 +05:30
committed by GitHub
parent d2a057c6f1
commit aeaa658f77
5 changed files with 100 additions and 9 deletions

View File

@@ -104,9 +104,19 @@ const OPENAI_CONTEXT_WINDOWS: Record<string, number> = {
'devstral-latest': 256_000,
'ministral-3b-latest': 256_000,
// MiniMax
// MiniMax (all M2.x variants share 204,800 context, 131,072 max output)
'MiniMax-M2.7': 204_800,
'MiniMax-M2.7-highspeed': 204_800,
'MiniMax-M2.5': 204_800,
'MiniMax-M2.5-highspeed': 204_800,
'MiniMax-M2.1': 204_800,
'MiniMax-M2.1-highspeed': 204_800,
'minimax-m2.7': 204_800,
'minimax-m2.7-highspeed': 204_800,
'minimax-m2.5': 204_800,
'minimax-m2.5-highspeed': 204_800,
'minimax-m2.1': 204_800,
'minimax-m2.1-highspeed': 204_800,
// Google (via OpenRouter)
'google/gemini-2.0-flash':1_048_576,
@@ -223,9 +233,19 @@ const OPENAI_MAX_OUTPUT_TOKENS: Record<string, number> = {
'mistral-large-latest': 32_768,
'mistral-small-latest': 32_768,
// MiniMax
// MiniMax (all M2.x variants share 131,072 max output)
'MiniMax-M2.7': 131_072,
'MiniMax-M2.7-highspeed': 131_072,
'MiniMax-M2.5': 131_072,
'MiniMax-M2.5-highspeed': 131_072,
'MiniMax-M2.1': 131_072,
'MiniMax-M2.1-highspeed': 131_072,
'minimax-m2.7': 131_072,
'minimax-m2.7-highspeed': 131_072,
'minimax-m2.5': 131_072,
'minimax-m2.5-highspeed': 131_072,
'minimax-m2.1': 131_072,
'minimax-m2.1-highspeed': 131_072,
// Google (via OpenRouter)
'google/gemini-2.0-flash': 8_192,