Skip to content

Context window: the smaller of /context's and acpmux's; a model switch drops the stale /context - #32665

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
lane/context-window-smaller
Nov 3, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
lane/context-window-smaller

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-ups from the review of #32639 (receipt: #32639 (review)). 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)".

  • compactingUsage now takes the smaller of the window Claude Code's /context names and acpmux's autocompact cap. Before, it always preferred /context, so a /context window just under the model's (say 980K on a 1M model) would have hidden a 400K cap.
  • direct.ts drops a /context breakdown 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 /context arrives, 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
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.

Written for commit e5ef800. Summary will update on new commits.

View guided diff Turn on auto-fix

…h drops the stale /context

Review follow-ups on #32639.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-7a7568197607c3cdfb81
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review e5ef800: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr32665 -f ref=lane/context-window-smaller -f platform=macos -f backend_mode=local

Gallery before/after for e5ef800: 16 states rendered, 2 images differ, 3011 more touched states not rendered. Images are in the run's artifact, not on this public PR; the independent review of this head reads them on its own, so the PR needs no hand-made screenshots of these states.

gh run download 41546978534 -R manaflow-ai/cmux -n gallery-advisory-32665-e5ef80095617d90f8d862d711a422a0f0d5b60b9 (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.live-chat-watch/choice-alone Apple System Colors Light unchanged 0% own direct.ts
agent-pane.live-chat-watch/choice-alone Apple System Colors unchanged 0% own direct.ts
agent-pane.live-chat-watch/view-only Apple System Colors Light unchanged 0% own direct.ts
agent-pane.live-chat-watch/view-only Apple System Colors unchanged 0% own direct.ts
agent-pane.live-chat-watch/take-over-refused Apple System Colors Light unchanged 0% own direct.ts
agent-pane.live-chat-watch/take-over-refused Apple System Colors unchanged 0% own direct.ts
agent-pane.approval-edits/single Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/single Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/single-multiedit Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/single-multiedit Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped-multiedit Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped-multiedit Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/single-long Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/single-long Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped-long Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.approval-edits/grouped-long Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/signed-in Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/signed-in Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/signed-out Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/signed-out Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/expired Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/expired Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/unknown Apple System Colors Light unchanged 0% imports direct.ts (1 hops)
agent-pane.auth-health/unknown Apple System Colors unchanged 0% imports direct.ts (1 hops)
agent-pane.chat-inspector/full Apple System Colors Light unchanged 0% imports usageStats.ts (1 hops)
agent-pane.chat-inspector/full Apple System Colors unchanged 0% imports usageStats.ts (1 hops)
agent-pane.chat-inspector/workflow-running Apple System Colors Light changed 0.0068% imports usageStats.ts (1 hops)
agent-pane.chat-inspector/workflow-running Apple System Colors changed 0.0058% imports usageStats.ts (1 hops)
agent-pane.chat-inspector/workflow-finished Apple System Colors Light unchanged 0% imports usageStats.ts (1 hops)
agent-pane.chat-inspector/workflow-finished Apple System Colors unchanged 0% imports usageStats.ts (1 hops)

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Unclear: web / react-apps-base-check (5) failed: no known signature; failed step: Run base reds and compare. This PR merged before its CI finished: fix forward on main.

CI failed on e5ef800956 (run 41546978876 attempt 1): 2 unknown.

Job Verdict Why
web / react-apps-base-check (5) unknown no known signature; failed step: Run base reds and compare
web / react-apps-check unknown no known signature; failed step: Check webview test shards

Not re-run automatically: web / react-apps-base-check (5), web / react-apps-check are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: web / Web status; a job it gathers is red on this change (its line here); do not merge until green; see lane-rules
red: web / react-apps-base-check (5); NEW webview test reds: test/worktree-creating.test.ts > (unnamed); do not merge until green; see lane-rules
red: web / react-apps-check; a job it gathers is red on this change (its line here); do not merge until green; see lane-rules

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 2, 2026

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (claude-opus-5-5): SHIP at e5ef800

@teamleaderleo teamleaderleo added the leo-named-fix An obvious fix to something Leo named: lands on push, review runs in parallel label Nov 3, 2026
@teamleaderleo
teamleaderleo merged commit 1923ed1 into feat-cmux-next Nov 3, 2026
200 of 210 checks passed
@teamleaderleo
teamleaderleo deleted the lane/context-window-smaller branch November 3, 2026 00:08
teamleaderleo added a commit that referenced this pull request Nov 3, 2026
context-autocompact-window: the fixture's acpmux cap (200k) is under the
400k /context window, and since #32665 Context reads the smaller of the two,
so the state read 171.4K / 200K. The /context chats now carry a 400k cap.

tasks-finished, workflow-finished, workflow-agent-failed: their shift rows
predate #32850 (Sources now sits right below Background tasks) and #32939
(the Show more row below the last section); opening the fold pushes those
rows down, which the browser's layout-shift entries count. The rows follow
the new layout.


Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — e5ef8009 Deployed Nov 2, 2026 by teamleaderleo via wait for same-key tree publisher #102968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

leo-named-fix An obvious fix to something Leo named: lands on push, review runs in parallel risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant