claude-code - 💡(How to fix) Fix [Bug] autocompact 调度路径在 v2.1.156 静默失败: 状态栏正确报告阈值但压缩动作不触发

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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).

Root Cause

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).

Fix Action

Workaround

Manually run /compact when context exceeds ~90%.

Code Example

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}
RAW_BUFFERClick to expand / collapse

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

ItemValue
PlatformmacOS Darwin 25.5.0
Claude Codev2.1.156
ModelGLM-5.1 (200K context)
SubscriptionMax
Shellfish 3.x
TerminaliTerm2

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).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Autocompact should trigger automatically when context usage reaches the threshold (~80-85%), as it did in versions prior to v2.1.153.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] autocompact 调度路径在 v2.1.156 静默失败: 状态栏正确报告阈值但压缩动作不触发