claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Auto-compact triggers at 12% context threshold causing infinite loop and rate limit exhaustion

Open Smithy060 opened this issue 2 months ago • 3 comments

Bug Description Feedback sent (receipt a5a004cf-b8ad-4e18-ab84-5d75688e5783) Sonnet 5 auto-compact fires @ 12% of session context creating a auto compact loop after 1 prompt which has maxxed my session & weekly limit.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.272
  • Feedback ID: e95540a5-c14e-4476-920c-c8e89e42f00b

Errors

[]

Smithy060 avatar Sep 15 '26 10:09 Smithy060

Auto-compact bug — token/quota burn quantification

Scope: 125 session transcripts, ~/.claude/projects/-Users-lewis-Claude/*.jsonl. Buggy event = trigger:"auto", sonnet-5-only session, preTokens < 300000.

Totals (all buggy events, 100% fall in the last 7 days):

  • Buggy auto-compactions: 106 across 11 sessions
  • Date range: 2026-09-14 09:22 to 2026-09-15 10:11 (all within the last 2 days)
  • Sum of postTokens (wasted summary output): 2,652,538 tokens
  • Sum of cache_creation_input_tokens on the 4 turns following each event (cache-rebuild tax): 16,541,827 tokens
  • Sum of cache_read_input_tokens on those same turns: 22,320,465 tokens
  • Sum of output_tokens on those same turns: 665,122 tokens
  • Combined direct token burn attributable to the bug (postTokens + cache_creation): 19,194,365 tokens, all inside the weekly quota window

Per-session breakdown (buggy events only): Session Version First buggy event Count Sum postTokens Sum cache_creation 0a38228a 2.1.270 2026-09-14 09:22:53Z 19 517,302 3,296,302 1afbde6e 2.1.270 2026-09-14 09:23:03Z 11 309,646 1,854,684 b8f69d47 2.1.270 2026-09-14 10:43:57Z 2 31,227 205,534 9c99abbb 2.1.270 2026-09-14 15:05:07Z 5 120,552 844,028 dcbce648 2.1.270 2026-09-14 16:08:32Z 1 18,104 137,759 b4494bcb 2.1.270 2026-09-14 16:26:51Z 18 522,011 2,894,850 58f2e5d3 2.1.270 2026-09-14 16:29:40Z 37 874,140 5,760,875 17f0b19a 2.1.270 2026-09-14 17:31:22Z 4 82,448 414,988 1bcd1097 2.1.270 2026-09-14 18:10:02Z 6 129,857 803,629 3cc77091 2.1.270 2026-09-15 08:04:48Z 2 30,682 239,564 bc3473c9 2.1.270 2026-09-15 09:50:52Z 1 16,569 89,614 TOTAL 106 2,652,538 16,541,827

Contrast — correct auto-compactions (mixed-model sessions, preTokens > 500k): Session Version preTokens postTokens 4275d3d7 2.1.263 968,947 34,298 f05b3bc1 2.1.263 972,441 30,309 f05b3bc1 2.1.263 968,417 31,089 9b3a3c30 2.1.267 967,514 40,695 Correct behaviour compacts roughly 8x less often per token of real work than the buggy ~118k threshold produces.

Smithy060 avatar Sep 15 '26 10:09 Smithy060

#anthropic @claude, can someone provide some assistance here? This has burned through 2 weekly resets.

Smithy060 avatar Sep 18 '26 11:09 Smithy060

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] avatar Nov 27 '26 10:11 github-actions[bot]