Repository navigation
cmux next focus: no reclaim inside the grant of a page that still has focus - #25689
Conversation
…eys back once the page blurred aReapplyInsideTheGrantDoesNotGrantAgain (red on feat-cmux-next since #24913) covers the other half: a reclaim inside the grant while the page still has focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… focus The grant's own key change (the page window's didBecomeKey) could re-apply the model, and its reclaim gave the keys straight back to the cmux window: two key changes, and the page stayed focused with no keys. keysReturned already treats key changes inside a grant as the grant's own; reclaim now does too, while the granted page still has focus. After a blur inside the grant it still reclaims. Fixes aReapplyInsideTheGrantDoesNotGrantAgain, red on feat-cmux-next since #24913 and surfaced by #25222 swift test run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
|
Bead |
Review and test results on head
|
| commit | contents | result |
|---|---|---|
cc9622ea43e0c |
tests only | ✘ aReapplyInsideTheGrantDoesNotGrantAgain(): (world.keys.changes → ["pageB", "cmux"]) == ["pageB"] (step a2f9a34a19f36acb8e279d77, aws-m4pro-6) |
6b40dd68f1c58 |
fix | ✔ 11 of 11 tests passed (step 5ebb2fa285f5ff65856e0f95, aws-m4pro-3) |
Correctness review (subagent): APPROVE, no blocking findings.
- The guard can't leave the keys on a page window when the target is elsewhere. Every cmux-window target goes through
blurChildWindowPage(), which callspageFocus.blurPage()beforereclaim, sogranting && page != nilis false there. A page target callsfocus(other)and never reclaims.reclaimKeyAfterActivationreturns early for page targets. DevTools paths setpage = nil. - Finding 1 (minor, existing before this PR):
focus(_:)usesdefer { granting = false }rather than restoring the previous value. A nested grant therefore clears the flag while the outer grant is still running. No production caller reachesreclaimin that window. Resolution: leaving it as a follow-up note (restore the previous value, and add a nested-grant test). It is out of scope for this red fix. - Finding 2 (low): no production path is known to call
reclaiminside a grant without blurring first, so this fix is defensive. Resolution: I corrected the PR body so it no longer claims a reproduced runtime bug. - Finding 3: the new test passes with or without the guard. It guards against the guard becoming too broad (for example, dropping
page != nil). It is not a red-to-green test. Resolution: this is intended and noted.
PR check reds, not from this change:
link: a GitHub API rate limit (HTTP 403 when posting a comment).post cmux-next/fast-gates: "no head or base sha to report", when the reporting job ran.
Dev build: cmux-ci job 0b6bc91559df084a6331c460, tag 25222-reclaim-inside-grant-fix, at this head.
There is no visible UI change, so no visual review was done.
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
web and size checks: green |
|
Review (claude-subagent correctness review): SHIP at 6b40dd6 Findings and resolution: #25689 (comment) |
|
Review (claude-subagent correctness re-review): SHIP at 4e53838 The head is two plain merges of
No findings. The earlier findings and their resolution are at #25689 (comment). |
|
Found 1 test failure on Blacksmith runners: Failure
|
|
Review (claude-subagent correctness re-review): SHIP at 169390e Re-review on the exact head after the third
Findings:
Earlier findings and how they were resolved: #25689 (comment). Previous receipt (superseded by this head): #25689 (comment) |
|
Review (claude-subagent correctness re-review): SHIP at baf8653 This re-review covers the exact head after Leo's fourth
Findings:
Earlier findings: #25689 (comment). This receipt supersedes #25689 (comment). |
|
Review (claude-subagent correctness re-review): SHIP at f8eb55e Re-review on the new head after the fifth plain merge of
Earlier reviews on previous heads: #25689 (comment) and #25689 (comment). Known base red: |
|
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/40594175819 at 002c20e failed: cmux-next checks (god files, concurrency, crash safety, l10n). |
|
Shipped in:
|
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Fixes #25222 (follow-up):
ChildPageFocusKeyChangeTests.aReapplyInsideTheGrantDoesNotGrantAgain()is red onfeat-cmux-next. It has failed since #24913 added it, and it surfaced when #25222cmux-next swift testrun put the suite in its priority filter. Base pushes skip that job.reclaim(into:when:)while the granted page still has focus.reclaimthen gave the keys straight back to the cmux window: two key changes for one focus request (["pageB", "cmux"]), with the page still recorded as focused and no keys. No production path is known to reach this today (focusPagenever reclaims, andblurChildWindowPageblurs first), so the fix is defensive: it makesChildPageFocushonor the contract the test states.ChildPageFocus.reclaimdoes nothing inside the grant of a page that still has focus.keysReturned(to:during:)already treats key changes inside a grant as the grant's own;reclaimnow does the same.reclaimruns fromblurChildWindowPage, which blurs the page first. If focus moves away during a grant (the model moved on to a terminal), the keys still come back to the cmux window. A new test covers that case.Changelog
ChildPageFocus.reclaimno longer hands the keys back to the cmux window in the middle of a grant to a page that still has focus.Tests
The command, on the fleet:
aReapplyInsideTheGrantDoesNotGrantAgain(): the existing test, red on the base.reclaimInsideTheGrantAfterThePageBlurredTakesTheKeysBack(): new; it guards the scoping.Observed / Not run
Results for the command above at
cc9622ea43e0c(tests only, expected red) and6b40dd68f1c58(fix, expected green) are added in a comment below.No capture: there is no visible UI change; the fix only decides which window has the keys.
🤖 Generated with Claude Code