[BUG] Claude Code auto-compaction runs indefinitely

Resolved 💬 3 comments Opened Apr 8, 2026 by HXLLL Closed May 21, 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?

When auto-compaction is triggered, it runs indefinitely, and drained all tokens in this session after running for ~15 minutes.

What Should Happen?

Claude should compact the previous converstaion, and continue to do the rest of its job.

Error Messages/Logs

Steps to Reproduce

I'm not sure about the exact trigger of this bug.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.96

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

iTerm2

Additional Information

<img width="953" height="167" alt="Image" src="https://github.com/user-attachments/assets/3f4eb9e9-6842-4e6e-8c58-c69a5c483f5c" />

As you can see in the screenshot, I was forced to interrupt the compaction. After that my current session is "100% used", though it still has ~ 1/3 before the compaction.

View original on GitHub ↗

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