cmux-next: what a page opens is a tab in its pane; Cmd-click still opens right

Merged
TE
15d ago
+137-92

Problem

Leo, 2026-10-20: opening a pull request from a chat "wants to open in the existing pane but ends up opening on the side as a split". Every link and path goes through LinkOpener and follows layout.linkPlacement, which defaults to Split Right since 2026-10-19. That includes:

  • the chat header's PR pill
  • reply and transcript links
  • Vault's Open Session Pull Request
  • Home's files
  • links in Markdown and code pages
  • New Tab picks behind the Debug toggle

So anything opened from a page landed in the pane on the right or in a new split, even though nobody asked for a split.

Change

The rule Leo set, as the coordinator decided it:

  • From a page (agent chat, Home, New Tab page, Markdown or code page, Files pane): what you open becomes a tab in that same pane. A pinned dock that takes no tabs (Home) still opens beside itself, as before.
  • Cmd-click in a terminal (URLs and files) and in a browser page's linkPlacement disposition: still placed by layout.linkPlacement, so the pane on the right by default. That keeps Lawrence's 2026-10-20 "cmd click on links needs to always open in the right" and CmdClickOpensRightTests.

How it is built:

  • LinkOpener.open/openWeb/openFile/target take cmdClick, and so does LinkRouter, the sink every surface's web link goes through. Only the terminal's link handler (URLs through LinkRouter, files directly) and BrowserPageRequests.openOnRight pass true.
  • DurableTabLink's fallback pane (a link to a tab that is gone) is now the source pane for a normal pane, not the pane on the right. Home still goes right.
  • The Debug toggle newTab.picksFollowLinks becomes links.pagesFollowPlacement (off by default). With it on, pages open where a Cmd-click does, which keeps Lawrence's 2026-10-19 behavior one switch away. New Tab picks use the same rule.
  • No default changes. The help text for Open Links and Files now says it is about Cmd-click, in all 21 locales.
  • What's New highlight: links-open-in-their-pane.md.

@lawrencecchen for awareness: Cmd-click is unchanged, but links clicked in chats and pages no longer go right unless the Debug toggle is on.

Left alone, and explicit: the header's Changes, Preview and Files buttons, Split Right and Split Down, subagent panes and the chat dock. Not in this PR:

  • The transcript's "diff" link and a background task's terminal open beside the chat through AgentBesidePlacement, Lawrence's 2026-10-13 decision. Changing them is a follow-up if wanted.
  • A cmux:// path link goes through CmuxAppLinks from the focused pane and now opens in that pane. It can't tell a terminal Cmd-click from a click in a page.

Tests

  • Commit 1 (8ff263fe), LinkOpenerTests.aLinkFromAPageOpensAsATabInItsPane(splitRight/newColumn/samePane). On base it fails for splitRight and newColumn: the link is made for the move to the right.
  • Commit 2: aCmdClickIsMadeForTheMoveToTheRightNotShownInTheSource keeps the Cmd-click path, and NewTabPagePickInPlaceTests runs on the renamed toggle.
  • Commit 3, from review: LinkRouterCmdClickTests. A link clicked in a page view reaches openInCmux with no Cmd-click; a terminal's Cmd-click arrives as one. Before this fix the app's openInCmux closure treated every web link as a Cmd-click, so the PR pill still split right.

Observed / Not run

  • Observed: check-app-size ok (no source-line growth); prepush-gate reports no new violations.
  • Not run: Swift tests and builds run on CI, not on these Macs. No dogfood build.

Changelog

Changed: A link, pull request or file you open from an agent chat, Home or the New Tab page opens as a tab in the same pane; Command-click in a terminal or browser still opens on the right.

Agent session: cosmic-gray

🤖 Generated with Claude Code