[Bug] Context limit hard-stop miscalibrated at ~30% of 1M window on Opus 4.7[1m]

Resolved 💬 3 comments Opened May 14, 2026 by cbscd Closed May 18, 2026

Bug Description
Context limit reached hard-stops at ~30% of 1M window on claude-opus-4-7[1m] (v2.1.141)

Environment

Claude Code: 2.1.141 (CLI)
Model: claude-opus-4-7[1m] (set as default via /model)
Plan: Max
Platform: macOS (Darwin 25.4.0)
DISABLE_AUTO_COMPACT=1 is set in ~/.claude/settings.json
Summary

On the 1M-context Opus 4.7 variant, Claude Code shows a hard-stop message — Context limit reached · /compact or /clear to continue — at approximately 30% of the reported window (~300K tokens), even though /context correctly reports the total window as 1M. This is distinct from the auto-compact trigger fixed in 2.1.117 (#50888); it appears to be a second miscalibrated threshold (hard ceiling / output-token reservation) that is still keyed to a smaller window.

Steps to reproduce

Set model to claude-opus-4-7[1m] (Max plan, CLI).
Set DISABLE_AUTO_COMPACT=1 in ~/.claude/settings.json to bypass the soft trigger.
Run a long working session (large file reads, multi-step agentic work).
Watch /context — total reads as 1m from the start.
Around ~300k / 1m tokens (30%), the conversation is hard-stopped with Context limit reached · /compact or /clear to continue. Further input is blocked.
Expected

The hard ceiling should be calibrated against the model's actual window (1M), with a reasonable output-token reservation subtracted (Opus 4.7 max output is 128K). Roughly ~870K of usable input would be expected before the hard stop fires.

Actual

Hard stop fires at ~300K input tokens. /context continues to display 1m as the denominator at the moment of the stop, so the displayed window and the enforced ceiling disagree.

/context snapshot at low usage (for reference)

37.5k/1m tokens (4%)
Free space: 962.5k (96.3%)
The denominator is correct; the enforcement boundary is not.

Related

#50888 — auto-compact-on-1M fixed in 2.1.117. Looks like the same calibration class of bug, in a different code path (hard ceiling / "Context limit reached" rather than soft auto-compact trigger).
#42375 — still-open report of incomplete fix on extended-context models.
#55504 — Opus 4.7[1m] capped at 200K on Desktop Max (different platform; related symptom).
Workaround

None that recover the 1M window. DISABLE_AUTO_COMPACT=1 only disables the soft trigger; it does not extend the hard ceiling. Manual /compact lets work continue but still operates inside the 300K floor.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.141
  • Feedback ID: 6b353f91-b8b6-43e8-94e0-abf524ee5ac1

Errors

[{"error":"Error: EISDIR: illegal operation on a directory, read '/Volumes/AAA/Projects/aaa/_bmad-output/implementation-artifacts'\n    at gYH (/$bunfs/root/src/entrypoints/cli.js:1578:144)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-14T18:30:16.118Z"},{"error":"Error: Agent type 'bmad-agent-blind-hunter' not found. Available agents: claude, claude-code-guide, Explore, general-purpose, Plan, statusline-setup\n    at call (/$bunfs/root/src/entrypoints/cli.js:3068:51309)\n    at eH3 (/$bunfs/root/src/entrypoints/cli.js:4128:8389)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-14T19:16:06.656Z"},{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at KS1 (/$bunfs/root/src/entrypoints/cli.js:439:16668)\n    at N9H (/$bunfs/root/src/entrypoints/cli.js:439:16843)\n    at _test (/$bunfs/root/src/entrypoints/cli.js:439:17385)\n    at MX (/$bunfs/root/src/entrypoints/cli.js:8880:8617)\n    at Uz_ (/$bunfs/root/src/entrypoints/cli.js:851:26581)\n    at Fz_ (/$bunfs/root/src/entrypoints/cli.js:851:29500)\n    at OO3 (/$bunfs/root/src/entrypoints/cli.js:5123:353)\n    at VX_ (/$bunfs/root/src/entrypoints/cli.js:5125:4002)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-14T19:16:59.861Z"},{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at KS1 (/$bunfs/root/src/entrypoints/cli.js:439:16668)\n    at N9H (/$bunfs/root/src/entrypoints/cli.js:439:16843)\n    at _test (/$bunfs/root/src/entrypoints/cli.js:439:17385)\n    at MX (/$bunfs/root/src/entrypoints/cli.js:8880:8617)\n    at Uz_ (/$bunfs/root/src/entrypoints/cli.js:851:26581)\n    at Fz_ (/$bunfs/root/src/entrypoints/cli.js:851:29500)\n    at OO3 (/$bunfs/root/src/entrypoints/cli.js:5123:353)\n    at VX_ (/$bunfs/root/src/entrypoints/cli.js:5125:4002)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-14T19:16:59.864Z"},{"error":"RangeError: path should be a `path.relative()`d string, but got \"..\"\n    at KS1 (/$bunfs/root/src/entrypoints/cli.js:439:16668)\n    at N9H (/$bunfs/root/src/entrypoints/cli.js:439:16843)\n    at _test (/$bunfs/root/src/entrypoints/cli.js:439:17385)\n    at MX (/$bunfs/root/src/entrypoints/cli.js:8880:8617)\n    at Uz_ (/$bunfs/root/src/entrypoin…

Note: Content was truncated.

View original on GitHub ↗

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