Fix copied surface link live identity - #9786
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughSurface links now carry live workspace and panel identities with stable workspace and surface fallbacks. URL parsing and target resolution support these identifiers across panel remapping and session restoration. ChangesLive surface-link identity
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CopyCommand
participant LinkBuilder
participant URLParser
participant TargetResolver
participant RestoredWorkspace
CopyCommand->>LinkBuilder: build link with live workspace and panel IDs
LinkBuilder-->>CopyCommand: URL with stable fallback IDs
CopyCommand->>URLParser: parse surface URL
URLParser-->>TargetResolver: navigation request
TargetResolver->>RestoredWorkspace: resolve runtime alias or stable fallback
RestoredWorkspace-->>TargetResolver: containing panel
TargetResolver-->>CopyCommand: resolved navigation target
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (3 errors, 1 warning, 1 inconclusive)
✅ Passed checks (20 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d6f313a. Configure here.
d6f313a to
469ef7d
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
469ef7d to
049f961
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
049f961 to
957397c
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |

Fix Copy Surface Link so copied surface links use the same live identity as Copy IDs and the socket tree.
Root cause:
Workspace.idand live surface IDs.Workspace.stableIdandPanel.stableSurfaceId.ContentView.copyFocusedSurfaceLink()built the link inline, so the command palette path bypassed the shared helper.Fix:
WorkspaceSurfaceIdentifierClipboardText.makeSurfaceLink(workspace:panelId:)now resolves the ownership target and emitsworkspace.idplus the live target surface ID.ContentView.copyFocusedSurfaceLink()now calls the shared helper.Verification:
163faca9b1c9f94f14eb5e295858bf0a9d39a2bd:cmuxTests/CmuxDurableDeepLinkRestoreTestsfailed in https://github.com/manaflow-ai/cmux/actions/runs/31151528078 becausecopiedSurfaceLinkMatchesCopyIdsLiveIdentity()sawcmux-dev://workspace/1FF69241-F971-4941-B1C4-FF6FFADAE43A/surface/2654739B-E6B9-4D11-9406-0292D9E84346instead of liveworkspace.idandpanel.idvaluesC64FB2DD-AF16-4C33-AA3A-09F88A6BED93and2C8401A5-C051-4B52-8FF9-02855C79F21A.d6f313aa4a8194c4fd46f2184231fbe0cead2a81:cmuxTests/CmuxDurableDeepLinkRestoreTestspassed in https://github.com/manaflow-ai/cmux/actions/runs/31150382314.d6f313aa4a8194c4fd46f2184231fbe0cead2a81:cmuxTests/RemoteTmuxNotificationLifecycleTestspassed in https://github.com/manaflow-ai/cmux/actions/runs/31151227252.cmux DEV slink2.appwith./scripts/reload-cloud.sh --tag slink2 --builder fleet --no-remote-derived-cache.com.cmuxterm.app.debug.slink2and socket/tmp/cmux-debug-slink2.sock, not the default socket.Copy IDsreturnedworkspace_id=8C25B979-6F70-4A44-9F62-18DC127EC319andsurface_id=E8712CAF-3307-432F-875D-4C8A5F947F3A.Copy Surface Linkreturnedcmux-dev-slink2://workspace/8C25B979-6F70-4A44-9F62-18DC127EC319/surface/E8712CAF-3307-432F-875D-4C8A5F947F3A.tree --allon/tmp/cmux-debug-slink2.sockcontained the workspace ID at line 80 and the surface ID at line 103.Note
Medium Risk
Changes navigation URL parsing, link generation, and resolution paths used for focus and deep links; behavior is well covered by tests but touches session-restore edge cases.
Overview
Copy Surface Link now matches Copy IDs: links use live
workspace.idand the ownership target’s live surface ID, with optionalstable_workspace_id/stable_surface_idquery parameters for durability. The command palette path calls the sharedmakeSurfaceLink(workspace:panelId:)helper instead of building stable-only URLs inline.Deep link handling parses those stable query params into
CmuxNavigationURLRequest.stableFallback, andAppDelegateresolves full requests (not just path targets). When live path IDs are stale—e.g. after session restore remaps panel IDs—CmuxNavigationTargetResolverfalls back to stable IDs. Surface descriptors also register runtime surface aliases (including remote tmux projected pane IDs) so links to owned/projected surfaces resolve to the container panel.Tests cover live-vs-stable parity, restore after ID remap, owned runtime IDs, and remote tmux copy-link resolution.
Reviewed by Cursor Bugbot for commit 049f961. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes “Copy Surface Link” to use live
workspace.idand live surface IDs, with stable-ID fallbacks so links keep working after restores, remaps, and remote tmux projections. Deep links now parse these fallbacks and resolve via the command palette and projected panes.WorkspaceSurfaceIdentifierClipboardText.makeSurfaceLink(workspace:panelId:)now emits live IDs and appendsstable_workspace_id/stable_surface_idquery params; added a helper to build links with fallbacks.CmuxNavigationURLRequest.parseaccepts and validates those fallback params and stores them asstableFallbackWorkspaceId/stableFallbackSurfaceId;surfaceLink(...)can include them when generating URLs.AppDelegatepasses the full request toCmuxNavigationTargetResolver, which addsresolve(_ request:)to use fallbacks when live IDs are stale and mapsruntimeSurfaceIds(e.g., projected panes) back to the container panel.Workspace.cmuxNavigationDescriptornow includesruntimeSurfaceIdsfor surfaces;ContentView.copyFocusedSurfaceLink()calls the shared helper.Written for commit 957397c. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes