Auto-compact stopped working in v2.1.62+ (regression from v2.1.50)

Status Fixed / completed
Reported on v2.1.50
Maintainer reply None cached
Activity 4 comments · opened Feb 28, 2026 · closed Feb 28, 2026

Bug Report: Auto-compact regression

Summary: Auto-compact (trigger: auto) stopped firing completely in v2.1.62 and v2.1.63. It worked reliably in v2.1.50 and earlier. Sessions now run all the way to 0 tokens remaining without auto-compact triggering.

Version regression data

Pulled from session JSONL files (~/.claude/projects/.../), looking at compact_boundary events:

| Version | Date | Auto compact triggers | Manual compact triggers |
|---------|------|-----------------------|------------------------|
| v2.1.39 | Feb 12 | 2 | 0 |
| v2.1.49 | Feb 23 | 12 | 0 |
| v2.1.50 | Feb 23 | 7 | 0 |
| v2.1.62 | Feb 28 | 0 | 3-5 |
| v2.1.63 | Feb 28 | 0 | 0-2 |

In v2.1.49/2.1.50, auto-compact fired correctly and logged events like:

{
  "type": "system",
  "subtype": "compact_boundary",
  "content": "Conversation compacted",
  "compactMetadata": {
    "trigger": "auto",
    "preTokens": 169714
  }
}

In v2.1.62/2.1.63, no trigger: auto events appear at all. Only trigger: manual events (user-initiated via Ctrl+R) appear.

Configuration

~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "75"
  }
}

This setting was working correctly in v2.1.50 - auto-compact fired at ~167k-180k tokens (roughly 75-90% of 200k context window). In v2.1.62+ it never fires at all, causing sessions to hit the context ceiling.

Environment

  • Platform: Windows 11 Pro
  • IDE: Antigravity IDE
  • Model: claude-sonnet-4-6
  • Current version: v2.1.63

Impact

Without auto-compact, long sessions (common for multi-step coding tasks) run to 0 context remaining, forcing a session restart and losing conversational context. Previously auto-compact would seamlessly extend sessions.

Workaround

Manually compact with Ctrl+R before context is exhausted.

View original on GitHub ↗

4 Comments

xXMrNidaXx · 7 months ago

This looks like a regression in the auto-compact trigger evaluation. Based on the data:

Timeline correlation:

  • v2.1.50 → v2.1.62 is a significant jump. Something in that delta changed the condition evaluation for trigger: auto.

Likely culprits:

  1. Threshold calculation change — The CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=75 env var might be getting ignored or parsed differently. Try removing it to see if the default behavior works.
  1. Token counting regression — If the token count method changed (e.g., switched tokenizers or changed what gets counted), the 75% threshold might never be hit because reported usage is lower than actual.
  1. Configuration loading order — Settings from ~/.claude/settings.json might be loaded after the auto-compact check is initialized, causing it to use defaults instead.

Debug suggestion:

# Check if env var is being read
CLAUDE_DEBUG=compact claude --version

# Or add verbose logging  
CLAUDE_CODE_DEBUG=autocompact* claude ...

If Anthropic devs are reading: the session JSONL data provided is excellent for pinpointing the regression. The preTokens field in older sessions shows the threshold was being evaluated correctly before.

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/28724
  2. https://github.com/anthropics/claude-code/issues/25867
  3. https://github.com/anthropics/claude-code/issues/24942

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

mettlem · 7 months ago

Closing as duplicate of #28724. Our data adds Windows confirmation + precise version regression timeline (worked in v2.1.50, broken in v2.1.62+) with JSONL evidence.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.