---
topic: claude-code-compaction-and-stalls
title: When to compact a Claude Code session with a 1M window, and where the unanswered messages come from
description: At what context size to set auto-compact in Claude Code (Opus 5.5, 1M window), and what is known about hung requests, where the message has to be sent a second time.
aliases: [compact, compaction, autocompact, auto-compact, context rot, context window, 1M, hang, ECONNRESET, no response, idle compaction, CLAUDE_CODE_AUTO_COMPACT_WINDOW]
domain: ai
created: 2026-11-18
license: CC BY 4.0, Jakub Dudek
address: https://stacks.jakubdudek.com/claude-code-compaction-and-stalls
---

## Conclusions

With no window set, Claude Code compacts sessions with a 1M window only at about 967K tokens [c1]. The author's compactions at ~500K are most likely idle compaction: Claude Code summarises a conversation above 200K before the one-hour cache expires, and the setting `idleCompaction: false` turns that off [c2]. This is a hypothesis; the compaction metadata in the transcripts does not tell this case apart.

There is no single right threshold; the sources differ. A measurement over 287 thousand calls points to a range of 200–600K: below ~200K frequent compactions eat working time, above ~600K no gain is visible [c3]. After a compaction the share of user corrections rises from 17.7% to 41.9% and stays there for at least 30 steps, so compacting too often does harm as well [c4]. A test of Opus 5.5 up to 928K showed no drop in information retrieval, but the published curves for multi-step tasks do fall, so its authors set 400K, with a defensible band of 300–500K [c5]. For the author's work (long, complex projects, building things) 400K is a reasonable setting.

Unanswered messages are a known, open problem on the connection side: the session hangs without using tokens, and Esc followed by sending again unblocks it at once [c6]. Since 11 November 2026 there is also a reported bug in which every request from a session above ~200K fails with ECONNRESET [c7]. The reporter works around it with an auto-compact window of 150K, which does not rescue sessions that are already too large [c8]. The author has had `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS=30000` set since 10 November, and manual resends have been clearly fewer since then, but the causal link has not been checked.

## Claims

### c1. With no window set, Claude Code compacts sessions with a 1M window at about 967K tokens.
- source: https://www.its-tahir.com/blog/claude-code-keeps-compacting · T4
- quote: With no window set, Claude Code auto compacts at the model's context limit: about 967K tokens on 1M-context models and 200K on 200K models.
- checked: 2026-11-18
- valid until: 2026-12-18

### c2. Idle compaction summarises a conversation above 200K before the one-hour cache expires, and idleCompaction: false turns it off.
- source: https://www.its-tahir.com/blog/claude-code-keeps-compacting · T4
- quote: that's idle compaction, not a lower threshold: it summarises a 200K+ token conversation before its one-hour cache expires, and `"idleCompaction": false` turns it off.
- checked: 2026-11-18
- valid until: 2026-12-18

### c3. A measurement of agent calls: below ~200K compactions eat working time, above ~600K no gain is visible.
- source: https://langwatch.ai/blog/context-tax-when-to-compact · T2
- quote: Below about 200k the post-compaction fog starts eating your working time. Above about 600k you are paying a large premium for a benefit I could not find in any of these measurements
- checked: 2026-11-18
- valid until: 2026-12-18

### c4. After a compaction the share of user corrections rises from 17.7% to 41.9%.
- source: https://langwatch.ai/blog/context-tax-when-to-compact · T2
- quote: In the five steps after a compaction, **41.9% of my messages contain a correction against a steady-state baseline of 17.7%**
- checked: 2026-11-18
- valid until: 2026-12-18

### c5. The Opus 5.5 test ended with the auto-compact window set to 400K, with a band of 300–500K.
- source: https://www.dashecorp.com/codi-e/context-rot-opus-5-5/ · T2
- quote: We set the auto-compact window to 400,000 tokens: 40% of the window, with a defensible band from 300K to 500K
- checked: 2026-11-18
- valid until: 2026-12-18

### c6. A hung session uses no tokens, and Esc followed by sending again unblocks it at once.
- source: https://github.com/anthropics/claude-code/issues/26224 · T4
- quote: the spinner keeps spinning, no tokens are consumed, and no progress is made. Pressing Escape and re-prompting immediately unsticks it
- checked: 2026-11-18
- valid until: 2026-12-18

### c7. Since 11 November 2026 requests from sessions above ~200K tokens fail with ECONNRESET.
- source: https://github.com/anthropics/claude-code/issues/109170 · T4
- quote: Starting around 22:50 UTC on 2026-11-11, every request from a session with more than ~200K tokens of context fails with:
- checked: 2026-11-18
- valid until: 2026-12-18

### c8. The ECONNRESET workaround is an auto-compact window of 150K; it does not rescue sessions that are already too large.
- source: https://github.com/anthropics/claude-code/issues/109170 · T4
- quote: keeps new sessions under the failing size. It doesn't help sessions that are already too large; those have to be abandoned
- checked: 2026-11-18
- valid until: 2026-12-18

## History
