Repository navigation
cmux-next: a clicked link's tab takes the focus; closing it gives the focus back - #22990
Conversation
…it back (red) Leo 2026-10-21: a link clicked in a chat opened its github.com tab without the focus; his Cmd-W then closed the chat. As in Chrome, a plain click's tab must take the focus, Cmd-W must close that tab, and closing it must give the focus back to where the link was clicked; a Cmd-click opens in the background. ClickedLinkFocusTests runs LinkOpener and Close Tab against a same-tree daemon: in the source's own pane the close selects the tab after it, not the source; in the pane on the right the focus stays there. LinkRouterCmdClickTests: a chat's Cmd-click opens in front. LinkRouter.open(_:modifiers:from:) only reads Shift-Command for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
This comment has been minimized.
This comment has been minimized.
|
owner: 01a15cc2-04ea-7352-837a-21905d44c199 on huge-blue |
|
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)
Gallery before/after for
States
Pick other states with a Unclear: CI failed on
Failures:
Matched log linesNot re-run automatically: Written by red: web / Web status; NEW: green on the base 5c4e212; do not merge until green; see lane-rules
Agents: Tour of |
… focus back As Chrome opens a clicked link (Leo 2026-10-21): - A chat's Cmd-click opens the link's tab in the background, a plain click in front (LinkRouter.opensInBackground; the agent pane passes the click's modifiers instead of only Shift-Command). - In the source's own pane the clicked tab is the new tab's opener: the tab goes right after it and its close selects it again (BrowserTabOpeners). - A focused link tab in another pane records where it was clicked; Cmd-W on it closes it and focuses that pane again (LinkOpener.returnPane), instead of leaving the focus in the link's pane. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
|
|
|
Bead |
…ling) The chat header's Preview (Changes and Files take the same beside path) keeps the focus in the chat today, and a link hover card's Open sends browser.open, which the host takes only for a local preview page, so it opens nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
The chat header's Changes, Preview and Files open where an agent's beside run puts its tab, but as a person's click (ActionInvocation.besideTakesFocus, never set by the control socket) the tab takes the focus and its close gives it back to the chat. An agent's own beside open still keeps the focus in the chat. A link hover card's Open and its Open in > cmux Browser send browser.openIn with cmux's id, so any http(s) link opens (browser.open only takes a local preview page), through LinkOpener.openWeb like a clicked link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…ts focus (failing) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…en in flight A clicked link begins a focus intent; an agent's beside open notes the intent generation when its run starts, and once the person acted since, it neither moves the focus back to the chat nor selects its tab in the pane that has the focus. The tab still lands, unselected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
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. |
|
Found 7 test failures on Blacksmith runners: Failures
|
…e app, not the person Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…e person's The chat's refocus after a lone chat docks went through PaneHandlers.focus, a user intent that bumps the focus generation, so a second beside open in flight read it as the person acting and skipped selecting its tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…compile) The closure inside a ternary was not inferred as @mainactor, so converting it to the @mainactor @sendable then of newBrowserTab failed to compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
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. |
…oes not convert to Comment) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
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. |
…b at it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
The close successor read opener relations over pane.tabs, which the close overlay had already emptied of the closing tab, so its opener was lost and the next neighbour was selected. Relations now also cover the tabs the pane's previous apply saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…n a pane goes back to the link tab's opener The tab list the close successor reads was only recorded inside the lazy `openers` closure, which runs only on a close: the first close in a pane had no earlier list, and a later one a stale one. closeRelations records (surface, tab id) pairs on every apply and hands the closure the previous apply's tabs plus the current ones. Value pairs, so no closed TabModel is kept; an emptied pane's entry is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…lose successor Review of 1245e16: one shared map keyed by pane key let a second window showing the same pane lose the closed tab's opener, leaked entries of torn down panes, and shared entries between fallback pane keys. The tabs now live on the PaneController; the test drives TabSelectionMemory.resolve in two windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…red) The click tests failed in four of eight runs: the link's tab landed selected, then the page the link was clicked in took the keyboard back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…eued pane changes land The window refuses an agent page's own makeFirstResponder for a page outside the focused pane. It read the focus before the coordinator's queued topology, so a link's tab whose focus that topology lands lost to the page the link was clicked in: the page's report, reduced after it, took the keyboard back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…-link-focus # Conflicts: # Packages/macOS/CmuxNext/Sources/CmuxNextApp/Handlers/AgentBesidePlacement.swift
…ed pane holds On the merged base the window shows the right pane through a new controller after the split, so comparing controllers failed though the focus and the selection were right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
…confirmed the split The window may show the confirmed pane through a new controller; a test that kept the provisional one compared against a controller no longer shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cc2-04ea-7352-837a-21905d44c199&host=huge-blue
|
Shipped in:
|
…click test Review of #23886: the schema export and its stamp still carried #22822's help text, and the revert deleted LinkRouterCmdClickTests with the Cmd-click-in-background test #22990 had added to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray
… to the agent chat (#23988) * cmux-next: Cmd-W keeps the focus in the closed tab's pane Leo 2026-10-21: "when i close a tab in the browser then it refocuses immediately back to the agent pane and so when im trying to close all stuff in the brwoser area tabs... it hopss over to my main pane and closes that". df5e2eb (#22990, "a clicked link's tab takes the focus; closing it gives the focus back") made every close of a tab opened from another pane (a clicked link, the chat header's Preview, Changes or Files) give the focus back to that pane, even while the tab's own pane still had tabs. Closing the browser tabs one by one sent the focus to the agent chat after the first, and the next Cmd-W closed the chat. The rule now: - A closed tab's pane keeps the focus while it has tabs, on the neighbour the close selects (the next tab, else the previous). - Only the close of a pane's last tab moves the focus to another pane (back to the pane its tab was opened from, as #22990 did). - After a person's Cmd-W emptied its pane, every Cmd-W that follows the one before it within the system's double-click interval closes nothing (EmptiedPaneCloseRun). Held-key repeats and quick presses both fit; the first press after a longer pause closes as usual. Tests: CloseTabKeepsPaneTests (three browser tabs beside an agent chat, four Cmd-Ws; pure tests of the neighbour rule and the run), and ClickedLinkFocusTests' other-pane case now expects the focus to stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray * cmux-next: keep the Cmd-W run per app; cover a held key's first repeat Review follow-up. The run of quick presses after a pane-emptying close lived in a static, so app-test suites running in parallel could swallow each other's Cmd-W. It now lives on AppServices with its window. The window is the double-click interval, or the key-repeat delay plus one repeat interval when that is longer, so a held Cmd-W's first repeat still belongs to the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray * cmux-next: CloseTabKeepsPaneTests compiles (no mutation inside #expect) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… tab in its pane (#23886) * Revert #22822: links and pages from a chat never open as a tab in its pane Leo 2026-10-21: "HOW COULD ANYBODY HAVE POSSIBLY THOUGHT OPENING A NEW TAB IN HERE BY DEFAULT WAS ACCEPTABLE", about his agent pane, and "#22822 was SO STUPID": he had asked about the tab-open animation, not where links go. This reverts commit 7997e21. Every link and file a terminal, an agent chat, Home or a page opens goes where layout.linkPlacement says again (the pane on the right, else a new split); the cmdClick plumbing, the links.pagesFollowPlacement toggle, its settings text and release note go. The New Tab pick toggle is newTab.picksFollowLinks again (default off: a pick takes the page's place). Kept from later work: main pane layout (#23105) and the Chrome-style link focus. ClickedLinkFocusTests: the in-pane case sets Same Pane; the file link test waits for the daemon's tab, not the split's pending one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray * Settings export for the reverted link help; keep #22990's background-click test Review of #23886: the schema export and its stamp still carried #22822's help text, and the revert deleted LinkRouterCmdClickTests with the Cmd-click-in-background test #22990 had added to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray * Settings stamp: the merged base's string catalog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray * Generated settings files: base's, with only this PR's help text The generated-file merge driver kept this branch's older exports over the base's, which dropped sidebar.showLocalMachine and voiceInput from them; the string catalog gets only the revert's 21 strings on top of the base's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d2d-622e-7433-aed6-f3c248542f5d&host=cosmic-gray --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Leo, 2026-10-21: a link clicked in a chat opened its github.com tab in a split but left the focus in the chat. His Cmd-W then closed the chat instead of the tab.
Behavior, as in Chrome:
besideTakesFocus). Only an agent's own open stays in the background.The focused-pane cue itself (ring, dim) is window-focus-opacity's own PR. This PR does not touch
ScreenContentView+Visibility.swift.The race the click tests found
The window refuses an agent page's own
makeFirstResponder(WebKit's, for the page's ownfocus()) for a page outside the focused pane (AgentPaneView.refusesSelfFocus). It read the focus before the focus coordinator's queued topology. So when a link's tab took the focus through a still-queued pane change, the chat page's own focus ask looked like the focused pane's. The queued change then landed the focus on the link's tab, and the page's report, reduced right after it, took it back: the tab showed selected with the keyboard still in the chat. The window now judges that ask againstcurrentState()(pending topologies reduced), only for a page's own ask outside an input event and the focus model's moves.Tests (red first)
ClickedLinkFocusTests(same-tree daemon): a link in its own pane, in the pane on the right, the header's Preview, a file link, a click while an agent's open is in flight, an agent's open from a lone chat, andaPagesOwnFocusAskLosesToAQueuedLinkTabFocus(the race above, without timing).BrowserTabOpenersCloseFocusTests: the closed link tab's successor is its opener, in every window showing the pane.LinkRouterCmdClickTests.aCmdClickInAPageViewOpensInTheBackground.Observed / Not run
cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg=suite --arg Packages/macOS/CmuxNext --arg ClickedLinkFocusTests,... --ref <sha>:aLinksTabInItsPaneTakesTheFocusAndItsCloseSelectsTheSourceAgainfailed at line 46 on 3159e23 and on 281579e (before the close fix).aPagesOwnFocusAskLosesToAQueuedLinkTabFocusfailed 3 of 3 on aeb526e (before the guard fix); before it, the click tests failed in 4 of 8 runs.ClickedLinkFocusTestspassed 8 of 8 runs, withAgentPaneSelfFocusTests,NewTabHoldFocusTestsandBrowserTabOpenersCloseFocusTests. After the base merge (a1eb805) and the test changes for it, 8 of 8 runs pass on ffe26d8 plus the one-lineRemoteChildSessionsTestsfix the base needs to compile its tests (open as cmux-next tests: RemoteChildSessionsTests' fake client states isReadOnly (base red: tests don't compile) #23362/cmux-next: the app test target compiles again (RemoteChildSessionsTests fake gets isReadOnly) #23363/cmux-next tests: RemoteChildSessionsTests compiles again (FakeClient gets isReadOnly) #23369), withChatDockLinkSplitMotionTests,AgentPaneSelfFocusTestsandBrowserTabOpenersCloseFocusTests.cmux-ci compile-check --app) passes on a19911d and on a1eb805.prepush-gate.py: no new violations.cmux-next swift teston 3fecec9 failed only on base reds (settings schema exports,AgentPaneImageActionsTests.swift:72and its crash, the same on cmux-next: right-side panels slide in without lag or overflow; directional enter and exit in the agent pane #22795).No capture: the change is where keyboard focus goes after a click, not how anything looks; the click tests above drive it against a real daemon and window.
Changelog
Agent session: huge-blue
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes link focus behavior in
cmux-nextso a clicked link takes focus in its new tab, Cmd-click opens it in the background, and closing it returns focus to where the link was clicked, matching Chrome.browser.openIn, wherebrowser.openonly worked for a local preview page.besideTakesFocus) the new tab takes focus and its close returns it to the chat; an agent's beside open still keeps focus in the chat.ClickedLinkFocusTestscovering same-pane, split-pane, header, file-link, mid-turn, and page-focus-ask scenarios, plusLinkRouterCmdClickTestsfor background opening.Written for commit ffe26d8. Summary will update on new commits.