Context window: the smaller of /context's and acpmux's; a model switch drops the stale /context
Follow-ups from the review of #32639 (receipt: https://github.com/manaflow-ai/cmux/pull/32639#pullrequestreview-5744774706). Leo, 2026-11-02: "whatever a user set their compact window to it should be that instead of always showing the defautl (e.g. we should be seieng 400k)".
compactingUsagenow takes the smaller of the window Claude Code's/contextnames and acpmux's autocompact cap. Before, it always preferred/context, so a/contextwindow just under the model's (say 980K on a 1M model) would have hidden a 400K cap.direct.tsdrops a/contextbreakdown taken for another model window when the usage window changes (a model switch). The meter then reads the model's own window until the next/contextarrives, instead of the old model's.
Tests: UsageStats.test.ts (3 pass, adds the 980K case) and test/session-info.test.tsx pass. Web lint passes.
Changelog
none
Observed / Not run
- Ran: the unit tests and web lint above.
- Not run: a model switch in a live build.
Agent session: agent session
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes context window calculation so the smaller of Claude Code's /context window and acpmux's autocompact cap is used, instead of always preferring /context. A /context window just under the model's (for example 980K on a 1M model) no longer hides a 400K cap.
Drops the stale /context breakdown when a model switch changes the usage window, so the meter reads the model's own window until the next /context arrives.