Repository navigation
Keep ssh-tmux mirror bookkeeping focus-neutral - #7742
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds completion-based remote tmux new-window handling, focus-aware command generation and routing, a mutation coordinator and snapshot to suppress focus and selection side effects during background mirror mutations, workspace and session-mirror wiring, project registration, and tests for the updated command flags and lifecycle behavior. ChangesRemote tmux mirror focus-neutral mutation flow
Estimated code review effort: 4 (Complex) | ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 21❌ Failed checks (1 warning, 20 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
Greptile SummaryThis PR keeps remote tmux mirror bookkeeping from changing user focus. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "refactor: extract remote tmux command se..." | Re-trigger Greptile |
Summary
@MainActorfocus-neutral mutation transactionsurface.createfocus intent end-to-end: background requests usetmux new-window -d, while explicit focus requests correlate tmux's stable new window id and focus only after its mirror tab existsRoot cause
Mirror topology synchronization used Bonsplit's ordinary user-interaction mutation APIs. Those APIs select newly created/reordered tabs, choose adjacent tabs during close, run
applyTabSelection, and schedule AppKit focus reconciliation. As a result, bookkeeping with no focus intent could change selection and make a hidden dedicated mirror window visible/key.The fix establishes one invariant at the shared mutation boundary: remote mirror bookkeeping cannot run focus/activation side effects, and its user-visible state is restored from one snapshot. Explicit focus is a separate post-bookkeeping action tied to the created tmux window id.
Verification
scripts/check-pbxproj.sh./scripts/lint-pbxproj-test-wiring.shpython3 scripts/swift_file_length_budget.pypasses;RemoteTmuxControlConnection.swiftshrinks from 1,177 lines at the PR base to 1,175, all new files stay below 500, and neither budget TSV changesLocal app builds/tests were intentionally not run per the issue constraints; GitHub CI is the compile/test gate.
Closes #7733
Closes #7737
Note
Medium Risk
Touches AppKit window/key restoration and broad focus/selection gates in
Workspaceduring mirror churn; incorrect snapshot restore could still steal focus or leave selection wrong, but scope is mirror-specific with new regression tests.Overview
Remote tmux mirror topology sync (create/close/reorder/rebuild) now runs inside a single focus-neutral transaction that snapshots and restores tab/pane selection, workspace selection, and window visibility/key state, while blocking
applyTabSelection,focusPanel, and deferred focus reconcile during the mutation.New-tab routing gains a
focusflag end-to-end: background creates sendnew-window -dso tmux does not steal the active window; focused creates use-P -F '#{window_id}'viasendNewWindow, with local focus applied only after the mirror tab exists (focusWindowWhenAvailable). Pending new-window callbacks are failed on reconnect/stop like activity queries.handleMirrorNewTabRequestedmoves toRemoteTmuxController+DecisionswithsessionMirror(workspaceId:)lookup; command send helpers move toRemoteTmuxControlConnection+Commands. Tests cover detached vs focused command strings and lifecycle focus preservation.Reviewed by Cursor Bugbot for commit 5ecd937. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit