Repository navigation
fix(context-meter): stop guessing a 200k window for 1M Claude sessions - #121
Conversation
Claude transcripts never state the window and strip [1m] from the model, so a session that gets 1M from the plan, ANTHROPIC_MODEL, settings or /model read against 200k until usage passed 200k, then jumped to 1M. - Backend returns configured_model for Claude, resolved in CLI order: --model arg, terminal then app ANTHROPIC_MODEL, then model in the project's .claude/settings.local.json / settings.json and the user's settings.json. - Window: usage over 200k (latched per terminal, so /compact does not shrink it), then the new Settings > Appearance override (Auto / 200k / 1M), then a [1m] alias in the configured or transcript model. Otherwise the window is unknown and the meter shows tokens only, with no percentage, warn/crit colour or sidebar bar. Fixes #120 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 11 changed file(s). No missing scanner-evidence signal was detected. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): CI/CD Recommendation, Cost/Token Risk. Scanned 11 changed file(s). Roadmap taxonomy buckets: CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Cost/Token RiskAI routing, usage, and token-budget changes should include budget or usage-limit evidence. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 11 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 11 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Config AuditCommit: No changed-config issues detected (success) Scanned 1 config file(s) present at this commit across 1 changed config path(s) and found no issues in the supported security rules. Changed config files:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Harness AuditCommit: No harness issues detected (success) Scanned 1 changed config file(s) and found no harness issues. Changed config files:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
Fixes #120
Problem
Claude transcripts never state the context window, and both
message.modelandrequestedModeldrop the[1m]suffix. The meter only checked the launch--modelarg, so a session that got 1M from the plan default,ANTHROPIC_MODEL, settings or/modelread against 200k: wrong percentage, early amber/red, a needless "Type /compact" nudge, and a jump to 1M once usage passed 200k.Fix
Backend (
context_usage.rs): for Claude,get_context_usagenow also returnsconfigured_model. It's resolved in the CLI's order:--model/--model=, the terminal'sANTHROPIC_MODEL, the app'sANTHROPIC_MODEL, thenmodelin<cwd>/.claude/settings.local.json,<cwd>/.claude/settings.json, and~/.claude/settings.json(orCLAUDE_CONFIG_DIR). It's re-resolved only when the transcript grows. Blank, missing or broken sources are skipped.Frontend (
contextMeter.ts): the Claude window is decided in this order.contextUsageStore.seenOver200k), so/compactdoesn't shrink the window.auto).[1m]alias in the configured model or the transcript model.A plain model can be 1M by plan default, so "unknown" avoids showing a made-up percentage.
Tests
configured_model_follows_cli_precedence,configured_model_skips_blank_broken_and_missing_sources.contextMeter.test.ts: the issue's case (74.6k,claude-sonnet-5-5+sonnet[1m]reads 7%, not 37%), unknown window, transcript[1m], latch, setting priority, and non-Claude agents ignoring the setting.ContextMeter.test.tsx: 1M reading, tokens-only display with no crit class and no sidebar bar, and the latch after a usage drop.npm run test:run1393/1393,cargo test --locked593/593,npx tsc --noEmitclean, clippy clean on the touched code,rustfmtoncontext_usage.rs.Notes
get_context_usagereply only gains a field. No cross-repo contract changes.🤖 Generated with Claude Code