Autocompact not triggering with Custom model (mimo-v2.5-pro) despite exceeding context limit
Status Closed — not planned
Maintainer reply None cached
Activity 1 comment · opened Jun 30, 2026 · closed Aug 17, 2026
Bug Report
Description
Autocompact feature does not trigger when using a Custom model, even when context usage exceeds the configured limit significantly.
Environment
- Claude Code Version: Latest (June 2026)
- Model: mimo-v2.5-pro (Custom model via OpenAI-compatible API)
- Platform: Windows 11
- Shell: Git Bash
Configuration
- Model context window: 1M (native support)
- Claude Code configured context: 200k (user preference)
- Autocompact threshold: 80% (default)
Steps to Reproduce
- Configure Claude Code to use a Custom model (e.g., mimo-v2.5-pro) with 200k context limit
- Have a long conversation with multiple Agent tool calls
- Monitor context usage with
/context - Observe that autocompact does NOT trigger even when context exceeds 200k (152%)
Expected Behavior
Autocompact should trigger when context usage reaches 80% of the configured 200k limit (160k tokens).
Actual Behavior
- Context reached 303k/200k (152%) without autocompact triggering
- Session eventually "ran out of context" and had to be manually resumed
- Manual
/compactworks correctly, reducing context to 18%
Evidence
Before manual compact:
Context Usage: 303k/200k tokens (152%)
After manual compact:
Context Usage: 36.2k/200k tokens (18%)
Root Cause Analysis
The issue appears to be that Claude Code calculates autocompact threshold based on the model's native context window (1M) rather than the configured context limit (200k):
- 303k ÷ 1M = 30% (below 80% threshold → no trigger)
- 303k ÷ 200k = 152% (should have triggered)
This is similar to the Opus 4.7 issue mentioned in changelog:
Fixed Opus 4.7 sessions showing inflated /context percentages and autocompacting too early — Claude Code was computing against a 200K context window instead of Opus 4.7's native 1M
Additional Context
- Multiple parallel Agent calls were used during the session
- The
/contextcommand correctly shows 200k as the limit - The issue is specific to Custom models where native context > configured context
Suggestion
Allow Custom model configuration to explicitly set contextWindow parameter, or ensure autocompact uses the configured limit (200k) rather than the model's native context window (1M).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗