Skip to content

fix(cloud): Cmd+T on a cloud pane selects the new remote terminal - #11612

Merged
lawrencecchen merged 4 commits into
mainfrom
feat-cloud-cmd-t-focus
Sep 2, 2026
Merged

lawrencecchen merged 4 commits into
mainfrom
feat-cloud-cmd-t-focus

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Cmd+T in a pane that projects a cloud terminal created the new terminal on the machine but left it behind the current tab, so the shortcut looked dead.

SurfacePaneFactory maps a projection onto the socket surface.create / surface.split handlers. Those honor requestedFocus only while a socket command with a focus-allowing policy is on the thread-local stack (v2FocusAllowed). In-app gestures (Cmd+T, Cmd+D, sidebar New Terminal Here) run with an empty stack, so the request was dropped. The factory now runs the handler under a policy frame equal to its focus argument, the same frame a focus-intent socket command pushes; app activation stays suppressed because the stack is non-empty. withSocketCommandPolicyStack becomes rethrows so the throwing factory body can run inside it.

Commit 1 adds SurfacePaneFactoryFocusTests (red on main), commit 2 the fix.

https://claude.ai/code/session_01Dg5MLmzriwRLTRCi8oh5R6


Summary by cubic

Cmd+T in a pane projecting a cloud terminal now selects the new remote terminal instead of leaving it behind the current tab. Cmd+D and sidebar "New Terminal Here" also honor their focus intent, while unfocused creates remain unfocused.

Bug Fixes

  • Runs factory routing under a focus policy frame composed from the caller's intent and the innermost active socket policy.
  • A focus-forbidding socket command can no longer regain focus through the factory, and app activation stays suppressed.
  • Adds tests for focused and unfocused creation of terminal tabs, splits, and browser projections.

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

Review in cubic

…et command

Cmd+T in a pane projecting a cloud terminal materializes the machine's new
terminal through SurfacePaneFactory, which drives the socket create handler.
That handler drops the focus request when no focus-allowed socket command is
active, so the tab is added but never selected. Red until the fix lands.

Claude-Session: https://claude.ai/code/session_01Dg5MLmzriwRLTRCi8oh5R6
SurfacePaneFactory maps a projection onto controlSurfaceCreate/Split, whose
focus handling is gated by v2FocusAllowed: it honors requestedFocus only while
a socket command with a focus-allowing policy is on the thread-local stack.
In-app gestures (Cmd+T, Cmd+D, sidebar New Terminal Here) run with an empty
stack, so the created tab was appended behind the current one.

Run the handler under a policy frame equal to the caller's focus argument, the
same frame a focus-intent socket command pushes. Activation stays suppressed
because the stack is non-empty. withSocketCommandPolicyStack becomes rethrows
so the throwing factory body can run inside it.

Claude-Session: https://claude.ai/code/session_01Dg5MLmzriwRLTRCi8oh5R6
@vercel

vercel Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux166 Ready Ready Preview Sep 3, 2026 7:39am UTC
cmux41 Canceled Canceled Sep 3, 2026 7:39am UTC

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 3a7661d4-776d-45e6-8d6f-ef80d750ec37

📥 Commits

Reviewing files that changed from the base of the PR and between 2526fbf and a95823c.

📒 Files selected for processing (4)
  • Sources/Surfaces/SurfacePaneFactory.swift
  • Sources/TerminalController.swift
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/SurfacePaneFactoryFocusTests.swift

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Cmd+D routes through the split handler and VM desktop/port previews through
the browser create handler; both sit behind the same focus gate.

Claude-Session: https://claude.ai/code/session_01Dg5MLmzriwRLTRCi8oh5R6
Review finding: replacing the stack with [focus] let a focus-forbidding socket
command regain focus through the factory. Compose the caller's intent with the
innermost existing frame instead, and test that a false outer frame wins.

Claude-Session: https://claude.ai/code/session_01Dg5MLmzriwRLTRCi8oh5R6
@lawrencecchen
lawrencecchen merged commit e3b14a1 into main Sep 2, 2026
10 of 12 checks passed
@lawrencecchen
lawrencecchen deleted the feat-cloud-cmd-t-focus branch September 2, 2026 12:46
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 2, 2026
5f1df81 Vpc dogfood fixes (manaflow-ai#11674)
c7bbfae cloud: one devbox snapshot per Freestyle size; the plan's memory picks the size (manaflow-ai#11664)
d18aa5f Merge pull request manaflow-ai#11670 from manaflow-ai/issue-remote-decode-errors
cd7d971 Admin Pro roster loads on page render and streams the scans (manaflow-ai#11668)
da8befc fix(remote): terminate reader on malformed JSON
8a93998 test(remote): cover malformed JSON cancellation
ce4cd50 fix(relay): stop when process file setup fails (manaflow-ai#11491)
e3b14a1 fix(cloud): Cmd+T on a cloud pane selects the new remote terminal (manaflow-ai#11612)
d90d8b8 Send Durable Object errors to Sentry (manaflow-ai#11657)
1a86aca Admin Pro roster: bounded team lookups, truncation flag, scan sequence guard (manaflow-ai#11662)
f277fe6 Merge pull request manaflow-ai#11643 from manaflow-ai/fix-11492-clone-killer
65c0c60 fix(test): make scoped attach killer mutable
8cdf1ce Cloud sidebar port links: direct private IPs, white link styling, reconnect-logic merge fix (manaflow-ai#11647)
6d1ca7e fix(tui): narrow workspace registry APIs (manaflow-ai#11498)
9f7ba2d Admin page: list every Pro user, team, and pending grant (manaflow-ai#11645)
23a5485 fix(relay): pin PTY cwd to validated descriptor (manaflow-ai#11417)
3214964 fix(relay): own the grep pattern before spawning the runner task (manaflow-ai#11653)
400d306 Fix devcontainer SSH TTY flag placement (manaflow-ai#9772)
613870c web: answer Stack Auth throttles on iroh routes with 429, add a Stack throttle circuit (manaflow-ai#11633)
f6be8ff web: resolve unoffered Cloud VM sizes to the plan machine instead of 400 (manaflow-ai#11644)
6d67bc5 Kill unvisited subtrees when the SSH auth cleanup deadline expires (manaflow-ai#11584)
790a7d8 Admin Pro access page: grant users, teams, and emails, manual downgrade (manaflow-ai#11605)
9bf04a3 fix(web): render the coderouter dashboard at request time (manaflow-ai#11632)
bcc362c test(cmux-tui): cover scoped attach PTY lifecycle (manaflow-ai#11492)
51a9495 Fix main CI after the Blaxel removal and non-root daemon landing (manaflow-ai#11586)
accfbdf Harden cmux-tui executable resolution before spawn (manaflow-ai#11427)
05c631d web: skip irrelevant Vercel builds and defer old changelog pages (manaflow-ai#11413)
40fd841 fix: render cloud VM terminals through native Ghostty manual I/O (manaflow-ai#11523)
1dd28a9 cloud: Freestyle devbox snapshot on the public platform (ubuntu user, base toolchain, Blaxel desktop), promote script, manifest as source of truth (manaflow-ai#11601)
4940db8 Pricing: Pro $50, Team $60, plan machine 5 vCPU / 20 GB / 200 GB, 50 VMs per seat (manaflow-ai#11610)

This branch was successfully deployed

2 active deployments
Preview – cmux166 — a95823c9 Deployed Sep 3, 2026 by vercel[bot]
Preview – cmux41 — a95823c9 Deployed Sep 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant