[Bug] autocompact 调度路径在 v2.1.156 静默失败: 状态栏正确报告阈值但压缩动作不触发
Summary
Autocompact trigger does not fire on v2.1.156 when context exceeds the threshold. The built-in statusline correctly reports context usage and shows the "Autocompact will trigger soon" warning, but the compaction action is never dispatched.
This is the same regression as #63015 but with additional diagnostic data from a different model (GLM-5.1) and the latest version (v2.1.156).
Environment
| Item | Value |
|------|-------|
| Platform | macOS Darwin 25.5.0 |
| Claude Code | v2.1.156 |
| Model | GLM-5.1 (200K context) |
| Subscription | Max |
| Shell | fish 3.x |
| Terminal | iTerm2 |
Steps to reproduce
- Start a session with heavy tool usage (MCP tools, file operations, contract compilation, agent spawning)
- Context grows to ~91% (182.7k / 200k)
- Statusline displays:
Context is 91% full — Autocompact will trigger soon - Continue interaction — context crosses 95%, 98%, 100%
- Autocompact never triggers despite the warning
- Must manually run
/compactto recover the session
Expected behavior
Autocompact should trigger automatically when context usage reaches the threshold (~80-85%), as it did in versions prior to v2.1.153.
Actual behavior
- Statusline correctly identifies threshold is crossed
- Warning message appears
- Compact dispatch never fires
- Session continues growing past context limit
- Only manual
/compactworks
Diagnostic data
GrowthBook cached feature flags (relevant ones)
tengu_compact_cache_prefix: false -- 不在实验组
tengu_sm_compact: false -- smart compact 未启用
tengu_cold_compact: false -- cold compact 未启用
tengu_sm_compact_config: {minTokens: 2000, maxTokens: 20000, minTextBlockMessages: 5}
Observations
tengu_compact_cache_prefixis false on my account, suggesting I am on the legacy compact path- The legacy path appears to be broken in v2.1.153+ — trigger detection works (statusline shows warning) but dispatch does not execute
- Manual
/compactalways succeeds, confirming the compact engine itself is functional - This affects the default threshold without any
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEset
Workaround
Manually run /compact when context exceeds ~90%.
Related issues
- #63015 — Same regression on v2.1.153
- #52390 —
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEdoes not trigger autocompact - #63186 —
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEin settings.json env block silently ignored - #42375 — Opus 4.6 1M context autocompact triggers at ~6%
Suggested fix
The regression appears to be in the compact dispatch code path rather than the detection logic. The statusline correctly identifies the threshold, meaning the detection side works. The dispatch path (likely refactored in v2.1.153 to support the new tengu_compact_cache_prefix flag) fails to invoke the compact engine when the flag is off (legacy path).
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗