feat(zones): restore Claude Code defaults to 1M model window - #18
Merged
Conversation
Reverts the 665K rescale that was applied on the basis of a single 2026-05-13 observation of auto-compact firing around 650K cumulative context. Subsequent multi-hundred-K sessions did not reproduce that trigger point — Opus 4.7 [1m] reaches ~95% (~950K) before client-side auto-compact engages, so a 665K ceiling left the upper third of the model window unused with no protective benefit. Restored defaults (proportional to 1M): Yellow 500K (50%) Orange 700K (70%) Red 900K (90%) Hard 1M (100%) Ceiling 1M Updates: - src/llm_relay/api/_zones.py — _CACHED_TOKEN_A_* defaults and comments - src/llm_relay/api/display.py:1087 — LLM_TOKEN_CEILING fallback - src/llm_relay/detect/tui.py:86 — ceiling fallback in session render - .env.public — operational override defaults + comment Tests: tests/test_api/test_turns.py already pins the _CACHED_* to 1M scale via the _zone_env fixture for assertion stability, so no test changes were needed; 529-test suite passes unchanged. Stock deployments without 1M context entitlement can pin a smaller ceiling via LLM_TOKEN_CEILING (e.g. =200000).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reverts the 665K zone rescale (b185b7a / 65251cf, 2026-05-13) and restores Claude
Code zone defaults to track the 1M model window of Opus 4.7 [1m].
Why
The 665K rescale was applied on the basis of a single 2026-05-13 observation
of auto-compact firing around 650K cumulative context. Subsequent
multi-hundred-K sessions did not reproduce that trigger point — including
sessions that crossed 700K without auto-compact firing. Anthropic's documented
behavior places client-side auto-compact at ~95% of the model window, which
for Opus 4.7 [1m] is ~950K.
The 665K ceiling left the upper third of the model window unused with no
protective benefit, and the displayed "Hard 665K reached" warnings on
sessions still well within the model's actual capacity were misleading.
Changes
Proportional rescale back to 1M (matches pre-b185b7a values):
Files:
src/llm_relay/api/_zones.py—_CACHED_TOKEN_A_*defaults + commentssrc/llm_relay/api/display.py:1087—LLM_TOKEN_CEILINGenv fallbacksrc/llm_relay/detect/tui.py:86— ceiling fallback in TUI session render.env.public— operational override defaults + rationale commentCHANGELOG.md— supersedes the prior "rescaled to 665K" Unreleased entryTest plan
pytest— 529 pass / 0 fail (the_zone_envautouse fixture intests/test_api/test_turns.pyalready pins_CACHED_*to 1M scale, sothe new defaults match what tests have always asserted — no test code
changes needed).
ruff check src/— cleanDeployment notes for stock environments
Operators without 1M context entitlement (default 200K Opus / Sonnet) should
set
LLM_TOKEN_CEILING=200000(or whatever their model's actual window is)to keep the ratio-based zones meaningful.