[BUG] Autocompact buffer (232.9k) exceeds 200k context window (116.5%) on Max plan — instant compaction loop after upgrading from 2.1.74

Resolved 💬 4 comments Opened Mar 14, 2026 by azizabbas Closed Mar 17, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description

After upgrading from v2.1.74 to v2.1.76, Claude Code enters an infinite compaction loop immediately on session start. The session becomes completely unusable — "context limit reached" appears before any user input.

## Root Cause

Running /status on 2.1.76 reveals the problem:

  • Context window: 200k tokens
  • Autocompact buffer: 232.9k tokens (116.5%)

The autocompact buffer is larger than the entire context window. It appears the buffer is calculated for a 1M window (~23% of 1M = 232.9k) but applied against a 200k window. This leaves zero usable space, triggering immediate and infinite compaction.

## Screenshot

[attach the screenshot here]

## Environment

  • Plan: Max ($100/mo)
  • Working version: 2.1.74 (200k window, no issue)
  • Broken version: 2.1.76
  • Model: claude-opus-4-6
  • Platform: macOS (Darwin 25.2.0, arm64)
  • Setup: Multiple plugins enabled, 2 MCP servers, custom skills

## Workaround

Downgrade to 2.1.74:
```bash
ln -sf ~/.local/share/claude/versions/2.1.74 ~/.local/bin/claude

Notes

  • CLAUDE_CODE_DISABLE_1M_CONTEXT=1 env variable did NOT fix the issue
  • autoUpdates is set to false in settings
  • The bug appears related to the 1M context feature added in 2.1.75 for Max plans — the buffer calculation seems to assume 1M even when the window is 200k

<img width="638" height="353" alt="Image" src="https://github.com/user-attachments/assets/e28fdfd4-d202-46c3-92e0-4b53588f1f5e" />

What Should Happen?

Of course, it should not behave like this, feels like a virus

Autocompact buffer should be sized relative to the actual context window (200k), not the 1M window.

Error Messages/Logs

Steps to Reproduce

  1. Be on Max $100/mo plan
  2. Have a working setup on v2.1.74
  3. Upgrade to v2.1.76
  4. Start a new session
  5. Immediately hits "context limit reached" and enters compaction loop

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.74

Claude Code Version

2.1.76

Platform

Other

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

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