[Bug] autocompact 调度路径在 v2.1.156 静默失败: 状态栏正确报告阈值但压缩动作不触发

Resolved 💬 2 comments Opened May 29, 2026 by phpmac Closed Jun 1, 2026

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

  1. Start a session with heavy tool usage (MCP tools, file operations, contract compilation, agent spawning)
  2. Context grows to ~91% (182.7k / 200k)
  3. Statusline displays: Context is 91% full — Autocompact will trigger soon
  4. Continue interaction — context crosses 95%, 98%, 100%
  5. Autocompact never triggers despite the warning
  6. Must manually run /compact to 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 /compact works

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

  1. tengu_compact_cache_prefix is false on my account, suggesting I am on the legacy compact path
  2. The legacy path appears to be broken in v2.1.153+ — trigger detection works (statusline shows warning) but dispatch does not execute
  3. Manual /compact always succeeds, confirming the compact engine itself is functional
  4. This affects the default threshold without any CLAUDE_AUTOCOMPACT_PCT_OVERRIDE set

Workaround

Manually run /compact when context exceeds ~90%.

Related issues

  • #63015 — Same regression on v2.1.153
  • #52390 — CLAUDE_AUTOCOMPACT_PCT_OVERRIDE does not trigger autocompact
  • #63186 — CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in 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).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗