Skip to content

feat(ssh): open SSH workspaces in VS Code Remote-SSH - #10005

Merged
AmethystLiang merged 1 commit into
mainfrom
jinjing/sta-2386-feature-support-open-in-vs-code-for-ssh-remote-workspaces
Jul 23, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
jinjing/sta-2386-feature-support-open-in-vs-code-for-ssh-remote-workspaces

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets the existing Open in entries launch a configured VS Code launcher against an SSH-backed worktree via Remote-SSH, on the machine running Orca:

code --remote ssh-remote+<authority> <remote-worktree-path>

VS Code owns Remote-SSH install/connection/auth/host-key errors. Orca keeps blocking local-only launchers and file-manager actions for SSH paths, and every local-OS open for remote-runtime workspaces.

What changed

  • Capability model, not a blanket block. File managers and non-VS Code launchers stay visible but disabled with trailing Local only metadata; a recognized VS Code command is enabled (Remote SSH metadata) and forwarded with connectionId.
  • Typed object IPC. shell:openInExternalEditor now takes { path, command?, connectionId? } and returns a dedicated ShellOpenExternalEditorResult with narrow remote failure reasons. Contract updated across shared, preload, renderer callers, and the web stub.
  • Main process stays authoritative. registerShellHandlers(store) now: rejects active/owned runtimes; resolves the SshTarget from the persisted Store; derives the authority — config alias (via the shared isOpenSshConfigBackedTarget predicate), or username@host on port 22, or ssh-alias-required on a non-default manual port; validates POSIX/Windows absolute remote paths without local stat/normalize/realpath; and rejects non-VS Code and compound commands before spawn.
  • Security. Authority and remote path are separate argv (never a shell string for SSH); connectionId is never interpolated; control-character authority fields are rejected; getSpawnArgsForWindows remains the .cmd/.bat shim boundary and fails closed on metacharacters; detached / ignored-stdio / windowsHide behavior preserved.
  • Same rules across all three surfaces: the worktree context menu, Explorer overflow (shared WorktreeOpenInMenuItems), and the source-control entry context menu (per-entry getOpenInEntryAvailability + connectionId wired from activeConnectionId).
  • Capability is command-based, not label-based: renaming the VS Code row keeps it working; naming another command "VS Code" does not grant remote capability.

Test plan

  • Focused unit tests pass (120 passed / 1 skipped): authority resolution (config alias, manual port-22 username@host, non-22 ssh-alias-required, legacy imported alias, blank/control-char invalid), launcher capability (stable/Insiders/direct+resolved Windows shims, compound/Cursor/Zed rejection), resolveVsCodeRemoteSshLaunchSpec exact --remote args + space preservation + closed unsupported/compound, IPC handler (relative-path/not-found local, SSH POSIX+Windows path bypass of local validation, runtime + runtime-owned rejection, alias-required recovery details, unsafe .cmd metachars → closed launch-failed), renderer capability + menu forwarding, and registerShellHandlers(store) wiring.
  • npm run typecheck — clean.
  • Changed-file oxlint + oxfmt -c — clean.
  • check:max-lines-ratchet — OK (no new bypasses).
  • git diff --check — clean.
  • verify:localization-coverage — passes; new keys present in en.json.
  • Pre-existing, unrelated: verify:localization-catalog reports missing keys in NewWorkspaceComposerCard.tsx, SshHostAdvancedFields.tsx, and sleep-worktree-flow.ts — none in this diff, and the keys are absent from main's en.json.

Notes

  • No migration or feature flag. Local launch behavior is unchanged; compound custom commands intentionally return remote-editor-unsupported for SSH in this release.
  • Remote-SSH is an extension outside the adjacent ../../vscode core checkout; the username@host port-22 fallback is a manual-matrix release gate, and detached spawn cannot report post-spawn connection/folder failures (by design).

Refs STA-2386
Closes #9999

Made with Orca 🐋

Allow the existing "Open in" entries to launch a configured VS Code
launcher against an SSH-backed worktree via Remote-SSH:

    code --remote ssh-remote+<authority> <remote-path>

- Split the blanket SSH/runtime block into a capability model: file
  managers and non-VS Code launchers stay local-only (disabled with
  "Local only" metadata); a recognized VS Code command is enabled and
  forwarded with connectionId over a typed object IPC.
- Main process stays authoritative: rejects active/owned runtimes,
  resolves the SshTarget from the persisted Store, derives the authority
  (config alias, or username@host on port 22, or ssh-alias-required on a
  non-default port), validates POSIX/Windows absolute remote paths without
  local stat/normalize, and rejects non-VS Code and compound commands
  before spawn.
- Authority and remote path are passed as separate argv; getSpawnArgsForWindows
  remains the cmd/bat shim boundary and fails closed on metacharacters.
- Same capability rules across the worktree menu, Explorer overflow, and
  the source-control entry context menu.

Refs STA-2386
Closes #9999
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fceb8216-fead-4067-a531-d141407f1705

📥 Commits

Reviewing files that changed from the base of the PR and between 9bdb820 and 835fead.

📒 Files selected for processing (21)
  • src/main/external-editor-launch.test.ts
  • src/main/external-editor-launch.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/shell.test.ts
  • src/main/ipc/shell.ts
  • src/main/ssh/system-ssh-args.ts
  • src/main/ssh/vscode-ssh-authority.test.ts
  • src/main/ssh/vscode-ssh-authority.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/right-sidebar/source-control-entry-context-menu.tsx
  • src/renderer/src/components/settings/KeybindingsFileActions.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInMenu.test.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInMenu.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/external-editor-open-capability.test.ts
  • src/renderer/src/lib/external-editor-open-capability.ts
  • src/shared/shell-open-types.ts
  • src/shared/vscode-remote-ssh-launcher.test.ts
  • src/shared/vscode-remote-ssh-launcher.ts

📝 Walkthrough

Walkthrough

The change adds structured external-editor IPC requests and results, VS Code Remote SSH launcher detection, and SSH authority validation. Shell handlers now receive the Store and support remote-runtime restrictions, SSH target lookup, path validation, remote launch resolution, and structured failures. Preload and renderer APIs use the new request shape, while menus compute local/remote availability, display metadata, and provide localized failure guidance. Tests cover launcher resolution, SSH authority rules, IPC behavior, and renderer interactions.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: enabling SSH workspaces to open in VS Code Remote-SSH.
Description check ✅ Passed It covers the summary, testing, and notes, but omits the screenshots and AI review/security audit sections from the template.
Linked Issues check ✅ Passed The changes implement the requested Remote-SSH open-in-VS Code flow for SSH-backed workspaces and supporting IPC/menu wiring.
Out of Scope Changes check ✅ Passed The added menu, IPC, type, and test updates all support the Remote-SSH feature, with no clear unrelated scope creep.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
src/renderer/src/i18n/locales/en.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

@AmethystLiang
AmethystLiang merged commit adc0203 into main Jul 23, 2026
5 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Allow the existing "Open in" entries to launch a configured VS Code
launcher against an SSH-backed worktree via Remote-SSH:

    code --remote ssh-remote+<authority> <remote-path>

- Split the blanket SSH/runtime block into a capability model: file
  managers and non-VS Code launchers stay local-only (disabled with
  "Local only" metadata); a recognized VS Code command is enabled and
  forwarded with connectionId over a typed object IPC.
- Main process stays authoritative: rejects active/owned runtimes,
  resolves the SshTarget from the persisted Store, derives the authority
  (config alias, or username@host on port 22, or ssh-alias-required on a
  non-default port), validates POSIX/Windows absolute remote paths without
  local stat/normalize, and rejects non-VS Code and compound commands
  before spawn.
- Authority and remote path are passed as separate argv; getSpawnArgsForWindows
  remains the cmd/bat shim boundary and fails closed on metacharacters.
- Same capability rules across the worktree menu, Explorer overflow, and
  the source-control entry context menu.

Refs STA-2386
Closes stablyai#9999
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.

[Feature]: Support "Open in VS Code" for SSH remote workspaces via Remote-SSH

1 participant