Repository navigation
fix(clipboard): route runtime-owned SSH image paste through the runtime - #19352
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughClipboard image saves now route through the runtime whenever Merge Risk: ⚪ Minimal · up to Clipboard image pastes for runtime-owned SSH targets now save through the owning runtime while preserving existing local SSH and local paste behavior. The covered routing and fallback paths indicate no remaining merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
✅ No new issues found.
Reviewed changes
- Runtime-owned SSH image paste routing —
saveClipboardImageBufferForTargetnow routes to the paired runtime whenever aruntimeEnvironmentIdis present, forwardingargs?.connectionId ?? nullinstead of gating on!connectionId. connectionIdthreading —clipboard-runtime-image-upload.tsthreads the target id throughclipboard.startImageUploadand the single-frameclipboard.saveImageAsTempFilefallback, replacing the hardcodedconnectionId: null.- Integration regression test — a new 7-test file pins the nested Remote Server → SSH case at the IPC seam against the real
ssh-filesystem-dispatchregistry, with per-regression mutation coverage documented in the PR body.
The root-cause analysis holds up against the surrounding code: getRepoSshConnectionId returns the runtime's nested target for a runtime: host (src/shared/execution-host.ts:204), and both terminal paste entry points (terminal-pane-paste-execution.ts, terminal-pane-menu-paste.ts) forward both ids verbatim, so the two id fields can never cross-route through the renderer. Wire compatibility is genuinely safe — connectionId is optional().nullable() on a non-strict zod schema and was already sent as null — and the client-local SSH, plain local, and runtime-only cases are all pinned as unchanged. The new assertions are exact (forwarded params and runtime call counts), not truthiness checks, so they will fail on regression.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Fixes #17679
ELI5
You have three machines in a row: your laptop, an Ubuntu box running Orca Server, and a Jetson that the Ubuntu box reaches over SSH. You copy a screenshot on the laptop and paste it into a terminal on the Jetson.
The laptop's job is only to hand the image to the Ubuntu box and say "put this on your Jetson connection." Instead, when the laptop saw the word "Jetson" in the request it went looking for a Jetson SSH connection in its own pocket. It never had one (the Ubuntu box dialed that connection, not the laptop), so it gave up with "Remote connection dropped. Click Reconnect" — advice that cannot help, because there is nothing on the laptop to reconnect.
Now the laptop hands the image to the Ubuntu box whenever the Ubuntu box owns the workspace, and tells it which of its SSH targets should receive the file.
Root cause
src/main/window/clipboard-ipc-handlers.tssaveClipboardImageBufferForTargetrouted to the paired runtime only whenruntimeEnvironmentId && !connectionId. It read "has an SSH connectionId" as "is a client-local SSH target". In the nested topology the renderer legitimately supplies both ids (terminal-clipboard-paste.tsforwards them verbatim;getRepoSshConnectionIddocuments that aconnectionIdbeside aruntime:host names the runtime's nested target). So the runtime was skipped and control fell toclipboard-image-temp-file.ts, which calledrequireSshFilesystemProvideron a registry (src/main/providers/ssh-filesystem-dispatch.ts) that only holds connections this process established. The nested connection lives in the Ubuntu server's process; the lookup missed and threwSSH_FILESYSTEM_PROVIDER_UNAVAILABLE_MESSAGE— the reported string verbatim.Second arm of the same defect:
clipboard-runtime-image-upload.tshardcodedconnectionId: nullon both the chunkedstartImageUploadand the single-framesaveImageAsTempFilefallback, so even after relaxing the guard the runtime would have saved the file on the Ubuntu host rather than the Jetson. Relaxing the guard alone would move the failure, not remove it.Fix (one change, both arms)
clipboard-ipc-handlers.ts: route to the runtime whenever aruntimeEnvironmentIdis present, forwarding theconnectionId(ornull).clipboard-runtime-image-upload.ts: threadconnectionIdthroughstartImageUploadand the single-frame fallback.Unchanged and pinned: plain client-local SSH (
connectionIdonly) still uses this process's provider registry; plain local paste (no args) still writes to the OS temp dir; a client-dialed target that really is gone still reports the dropped-connection verdict.Boundaries
clipboard.startImageUpload/clipboard.saveImageAsTempFilehave acceptedconnectionId: string | nullsince they were introduced, and the server already honours it on commit (src/main/runtime/rpc/methods/clipboard.ts). The web client has forwarded it all along (web-clipboard-api.ts). This PR only makes the desktop client send a value the server already understands.getRuntimeEnvironmentIdForWorktree/getConnectionIdresolve folder workspaces too, and the main-process change is shape-only.Reproduction
Image paste failed: ... Remote connection dropped. Click Reconnect on the SSH target before retrying.Before / after proof (#17679)
Probe at the IPC seam,
clipboard:saveImageAsTempFile, with onlyelectronand the runtime transport mocked; the realssh-filesystem-dispatchregistry is used, with one client-dialed connection registered and the nested target deliberately absent (as in the real client process). Same instrument that reproduced the reported string.{connectionId:'jetson', runtimeEnvironmentId:'ubuntu-server'}ERR Remote connection dropped. Click Reconnect on the SSH target before retrying.— runtime calls=0OK /tmp/on-runtime-target.png— runtime calls=3,startImageUpload {connectionId:'jetson'}{runtimeEnvironmentId:'ubuntu-server'}startImageUpload {connectionId:null}startImageUpload {connectionId:null}(unchanged)ERR Remote connection dropped ...(runtime never consulted)ERR Unknown environment(runtime's own verdict, runtime calls=1){connectionId:'client-dialed'}/var/tmp/orca-paste-...png, runtime calls=0undefined/tmp/orca-paste-...pngSymptom map: (a) the paste failure — row A; (b) the misleading Reconnect advice — row A/C now surface the runtime's own verdict; (c) hardcoded
connectionId:null— row A'sstartImageUploadparams now name the target; (d) client-local SSH and plain local keep working — rows D/E.Not yet measured on a real three-machine stack; the nested arg shape is established from the renderer selectors against the repo's own fixtures (
connection-context.test.ts"keeps a runtime host nested SSH target"). An end-to-end confirmation on real nested hardware is worth doing once this lands.Verification bar
New
src/main/window/clipboard-runtime-owned-ssh-paste.test.ts(7 tests, real SSH registry, nested args passed as one object and asserted from the same object the handler received). Per-regression mutation results — each mutation re-introduces exactly one defect:&& !args?.connectionIdguard onlystartImageUploadhardcodesconnectionId: nullconnectionId: nullconnectionIdgoes to the runtimeAlso green:
clipboard-ipc-handlers.test.ts(23),runtime/rpc/methods/clipboard.test.ts,web-preload-api-clipboard.test.ts,terminal-clipboard-paste.test.ts,clipboard-dashboard-popout-access.test.ts;pnpm tc:node;pnpm run check:code-quality:changed; oxfmt.