Repository navigation
Add SSH config host picker to add-host dialog - #12334
Conversation
Users can now click 'Fill from ~/.ssh/config…' to browse available SSH config hosts in a picker, select one, and have the form automatically prefill with resolved connection details (hostname, port, username, auth). Previously, an 'import' button provided bulk sync on this form—confusing and unhelpful when everything was already synced. That action is now available as a secondary 'Add all' option in the picker.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdded SSH config host listing and alias resolution across the main process, IPC, preload, web fallback, and renderer. Added cached search, suppression handling, duplicate detection, resolution mapping, form prefilling, bulk import, and picker UI states. Added case-insensitive alias reclamation and deletion suppression. Added GSSAPI and resolved identity handling. Added configured-only execution-host filtering for project, setup, group, workspace, and composer selection. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/settings/ssh-target-draft.test.ts (1)
316-327: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd
gssapiAuthenticationto the dirty-field table.This PR adds
gssapiAuthenticationtoEditingTargetand toisSshTargetFormDirty. The table comment states that every editable field must be covered. The new field is not in the table, so a future regression in that comparison would not fail any test.💚 Proposed test addition
{ identityFile: '~/.ssh/id_ed25519' }, + { gssapiAuthentication: true }, { proxyCommand: 'nc %h %p' },
🧹 Nitpick comments (3)
src/renderer/src/components/sidebar/AddRemoteHostSshConfigPicker.tsx (1)
177-184: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid hardcoding the result limit in the truncation message.
The text states "first 100 matches" as a literal string, but the actual limit lives in
SSH_CONFIG_HOST_RESULT_LIMITinsrc/main/ssh/ssh-config-host-picker.ts. If that constant changes, this message will not match the real limit.Pass the limit value as a prop and interpolate it, the same way
sshConfigPickerAddAllinterpolatesnewHostCount.src/renderer/src/components/sidebar/add-remote-host-ssh-actions.ts (1)
235-249: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider sharing the host-limit constant instead of hardcoding
100.This legacy-array fallback hardcodes
100as the page size.SSH_CONFIG_HOST_RESULT_LIMITalready exists insrc/main/ssh/ssh-config-host-picker.tsfor the same purpose, but it lives in main-process code and cannot be imported here directly.Move the constant to
src/shared/ssh-types.ts(same pattern asMAX_SSH_RELAY_GRACE_PERIOD_SECONDS) so both the main-process picker and this renderer fallback stay in sync.src/renderer/src/components/sidebar/AddRemoteHostSshFormPanel.tsx (1)
47-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the shadcn
Buttonprimitive for the config link action.This control is a raw
<button>with hand-written link styling. The sharedButtonprimitive supplies the focus-visible ring, disabled handling, and token-based colors. Without it, keyboard users get no visible focus indicator on this action.As per coding guidelines: "All UI work must follow
docs/STYLEGUIDE.md, use tokens fromsrc/renderer/src/assets/main.css, and use shadcn primitives fromsrc/renderer/src/components/ui/".♻️ Proposed refactor
- <button - type="button" - className="self-center text-left text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-50" - onClick={onFillFromConfig} - disabled={disabled} - > + <Button + type="button" + variant="link" + className="h-auto self-center p-0 text-xs text-muted-foreground hover:text-foreground" + onClick={onFillFromConfig} + disabled={disabled} + > {translate( 'auto.components.sidebar.AddRemoteHostDialog.fillFromSshConfig', 'Fill from ~/.ssh/config…' )} - </button> + </Button>Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 26a1dbd9-9139-47d3-8474-7ecf94b5753f
📒 Files selected for processing (43)
src/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/ssh/ssh-config-host-picker.test.tssrc/main/ssh/ssh-config-host-picker.tssrc/main/ssh/ssh-config-parser.test.tssrc/main/ssh/ssh-connection-store.test.tssrc/main/ssh/ssh-connection-store.tssrc/main/ssh/ssh-connection.test.tssrc/main/ssh/ssh-multi-key-authentication.test.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/NewWorkspaceComposerCard.test.tsxsrc/renderer/src/components/new-workspace/ProjectHostSetupCombobox.test.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.tsxsrc/renderer/src/components/settings/ssh-target-draft.test.tssrc/renderer/src/components/settings/ssh-target-draft.tssrc/renderer/src/components/settings/ssh-target-save-payload.tssrc/renderer/src/components/sidebar/AddRemoteHostDialog.tsxsrc/renderer/src/components/sidebar/AddRemoteHostFields.tsxsrc/renderer/src/components/sidebar/AddRemoteHostServerFormPanel.tsxsrc/renderer/src/components/sidebar/AddRemoteHostSshConfigPicker.tsxsrc/renderer/src/components/sidebar/AddRemoteHostSshFormPanel.tsxsrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.test.tssrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.test.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/new-workspace-project-options.test.tssrc/renderer/src/lib/new-workspace-project-options.tssrc/renderer/src/lib/project-host-setup-options.test.tssrc/renderer/src/lib/project-host-setup-options.tssrc/renderer/src/lib/project-host-workspace-target.test.tssrc/renderer/src/lib/project-host-workspace-target.tssrc/renderer/src/web/web-preload-api.tssrc/shared/execution-host-registry.test.tssrc/shared/execution-host-registry.tssrc/shared/ssh-types.tsssh-import-ux-mock.html
💤 Files with no reviewable changes (4)
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/zh.json
- Reuse search loader on import completion to preserve active filter inside generation guard - Fall back to hostname when manual host has no label, not empty string - Make alias duplicate detection case-insensitive to match config picker behavior - Validate host availability when restoring project group selection - Add aria-selected attribute to picker options for accessibility
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/hooks/useComposerState-host-context-boundaries.test.ts (1)
514-528: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftTest the restoration behavior instead of the source text.
sourceBetween(...).toContain(...)can pass while the hook still restores an unavailable group. It also couples the test to dependency-array formatting. RenderuseComposerStatewith an unavailableactionableHostIdsset and assert thatselectedProjectGroupIdremains unset. Then make the host actionable and assert that restoration occurs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8f494ff3-6f2b-4fd7-aa09-528567f9f914
📒 Files selected for processing (8)
src/renderer/src/components/sidebar/AddRemoteHostDialog.tsxsrc/renderer/src/components/sidebar/AddRemoteHostSshConfigPicker.tsxsrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.test.tssrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.test.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.tssrc/renderer/src/hooks/useComposerState-host-context-boundaries.test.tssrc/renderer/src/hooks/useComposerState.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- src/renderer/src/components/sidebar/ssh-target-duplicate.test.ts
- src/renderer/src/components/sidebar/ssh-target-duplicate.ts
- src/renderer/src/components/sidebar/add-remote-host-ssh-actions.ts
- src/renderer/src/components/sidebar/AddRemoteHostSshConfigPicker.tsx
- src/renderer/src/hooks/useComposerState.ts
- src/renderer/src/components/sidebar/AddRemoteHostDialog.tsx
Review findings on the ~/.ssh/config picker + bulk add: - Guard config-host resolution with a generation counter so a late resolve cannot overwrite a later pick or a form the user backed out of; freeze the other rows while a pick resolves. - Stop "Add all N" from re-adopting deleted hosts — it now imports without reAdopt, matching the new-host count it advertises. Settings → Import keeps the explicit re-adopt path. - Fold SSH aliases through a shared normalizeSshConfigAlias for import ownership, delete tombstones, reclaim, picker search, and the save-time duplicate check, which now occupies configHost *and* label like the picker. - Persist GSSAPIAuthentication only when a parsed Host entry asks for it, not when `ssh -G` merely echoes the /etc/ssh system default. - Fail closed with unavailable/setup-not-found when an explicit projectHostSetupId names a non-actionable host instead of silently creating the workspace on a sibling host. - Cache the parsed config for the picker session (refresh on open/retry) so filter keystrokes no longer reparse and Include-expand the file, keep the filter usable during loads, add a Retry on load errors, explain an empty Identity file after a config fill, and drop the always-false aria-selected.
Move SSH_CONFIG_HOST_RESULT_LIMIT to shared types so the renderer's limit message cannot drift from the host's query limit. Extract findActionableFolderProjectGroup to avoid repeating the folder-host-availability check across the composer hook.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/main/ssh/ssh-config-host-picker.ts (1)
96-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReject aliases that are no longer in the SSH configuration.
Line 96 resolves the alias before confirming that it is still a configured host.
ssh -Gcan return default settings for an unknown alias, including a hostname. A stale picker item can then create a target instead of returningnull.Validate the normalized alias against a current configuration snapshot before resolving it. Add a test where the resolver returns defaults but
loadConfigHostshas no matching host.src/renderer/src/lib/project-host-workspace-target.ts (1)
201-229: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not fall back from an explicit
hostId.When Line 202 finds no target, execution continues to the legacy fallback. Lines 224-229 can return a ready target on another actionable host. This creates the workspace on a host that the caller did not select.
If
hostIdis present and no target exists on that host, return an unavailable result. Add a test with an unavailable selected host and a ready setup on another host.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a8bfec6d-0381-42c6-a239-7f29ce77c588
📒 Files selected for processing (24)
src/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/ssh/ssh-config-host-picker.test.tssrc/main/ssh/ssh-config-host-picker.tssrc/main/ssh/ssh-connection-store.test.tssrc/main/ssh/ssh-connection-store.tssrc/renderer/src/components/settings/ssh-target-draft.test.tssrc/renderer/src/components/sidebar/AddRemoteHostDialog.config-picker.test.tsxsrc/renderer/src/components/sidebar/AddRemoteHostDialog.tsxsrc/renderer/src/components/sidebar/AddRemoteHostFields.tsxsrc/renderer/src/components/sidebar/AddRemoteHostSshConfigPicker.tsxsrc/renderer/src/components/sidebar/AddRemoteHostSshFormPanel.tsxsrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.test.tssrc/renderer/src/components/sidebar/add-remote-host-ssh-actions.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.test.tssrc/renderer/src/components/sidebar/ssh-target-duplicate.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/new-workspace-project-options.test.tssrc/renderer/src/lib/new-workspace-project-options.tssrc/renderer/src/lib/project-host-workspace-target.test.tssrc/renderer/src/lib/project-host-workspace-target.tssrc/shared/ssh-config-alias.tssrc/shared/ssh-types.ts
🚧 Files skipped from review as they are similar to previous changes (10)
- src/shared/ssh-types.ts
- src/renderer/src/components/sidebar/ssh-target-duplicate.ts
- src/main/ipc/ssh.ts
- src/renderer/src/components/sidebar/ssh-target-duplicate.test.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/components/sidebar/AddRemoteHostSshFormPanel.tsx
- src/renderer/src/components/sidebar/AddRemoteHostFields.tsx
- src/renderer/src/hooks/useComposerState.ts
- src/main/ipc/ssh.test.ts
- src/renderer/src/components/settings/ssh-target-draft.test.ts
In E2E tests and sandboxes, isolated HOME can differ from the system passwd home. OpenSSH resolves the default config via getpwuid (passwd), while Node's loadUserSshConfig uses os.homedir() (HOME-aware). Pass -F to explicitly specify the config path when they diverge, so ssh -G and the picker resolve the same file.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 005b200f-28f6-4ead-8b35-5fa07c16d73f
📒 Files selected for processing (5)
src/main/ssh/ssh-g-config-resolution.tstests/e2e/helpers/ssh-config-host-picker.tstests/e2e/ssh-config-host-import.spec.tstests/e2e/ssh-config-host-picker.PLAN.mdtests/e2e/ssh-config-host-picker.spec.ts
|
@coderabbitai[bot] fixed |
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
When a user edits ~/.ssh/config and removes a host, the import picker should not fall back to ssh -G's echoed response (which treats any alias as valid). Check the reloaded config file before resolving. - Force reload config on each resolve to catch user edits post-open - Reject aliases not in the current config before calling ssh -G - Add test for deleted alias edge case - Fix workspace-target fallback to honor explicit host selection
Allow users to reclaim a deleted SSH host by re-picking it from ~/.ssh/config. Tombstoned aliases now appear in the picker with a "Removed from Orca" badge and remain pickable, but don't count toward "Add all" operations — ensuring passive import never resurrects a deleted alias while still giving the user a recovery path.
* feat(ssh): add SSH config host picker for add-host form Users can now click 'Fill from ~/.ssh/config…' to browse available SSH config hosts in a picker, select one, and have the form automatically prefill with resolved connection details (hostname, port, username, auth). Previously, an 'import' button provided bulk sync on this form—confusing and unhelpful when everything was already synced. That action is now available as a secondary 'Add all' option in the picker. * fix(ssh): import filter preservation and label fallback - Reuse search loader on import completion to preserve active filter inside generation guard - Fall back to hostname when manual host has no label, not empty string - Make alias duplicate detection case-insensitive to match config picker behavior - Validate host availability when restoring project group selection - Add aria-selected attribute to picker options for accessibility * fix(ssh): harden config picker import, alias folding, and host targeting Review findings on the ~/.ssh/config picker + bulk add: - Guard config-host resolution with a generation counter so a late resolve cannot overwrite a later pick or a form the user backed out of; freeze the other rows while a pick resolves. - Stop "Add all N" from re-adopting deleted hosts — it now imports without reAdopt, matching the new-host count it advertises. Settings → Import keeps the explicit re-adopt path. - Fold SSH aliases through a shared normalizeSshConfigAlias for import ownership, delete tombstones, reclaim, picker search, and the save-time duplicate check, which now occupies configHost *and* label like the picker. - Persist GSSAPIAuthentication only when a parsed Host entry asks for it, not when `ssh -G` merely echoes the /etc/ssh system default. - Fail closed with unavailable/setup-not-found when an explicit projectHostSetupId names a non-actionable host instead of silently creating the workspace on a sibling host. - Cache the parsed config for the picker session (refresh on open/retry) so filter keystrokes no longer reparse and Include-expand the file, keep the filter usable during loads, add a Retry on load errors, explain an empty Identity file after a config fill, and drop the always-false aria-selected. * refactor(ssh): centralize host result limit and extract folder group val Move SSH_CONFIG_HOST_RESULT_LIMIT to shared types so the renderer's limit message cannot drift from the host's query limit. Extract findActionableFolderProjectGroup to avoid repeating the folder-host-availability check across the composer hook. * fix(ssh): pass -F to ssh -G when HOME differs from passwd home In E2E tests and sandboxes, isolated HOME can differ from the system passwd home. OpenSSH resolves the default config via getpwuid (passwd), while Node's loadUserSshConfig uses os.homedir() (HOME-aware). Pass -F to explicitly specify the config path when they diverge, so ssh -G and the picker resolve the same file. * fix(ssh): verify config host exists before resolving with ssh -G When a user edits ~/.ssh/config and removes a host, the import picker should not fall back to ssh -G's echoed response (which treats any alias as valid). Check the reloaded config file before resolving. - Force reload config on each resolve to catch user edits post-open - Reject aliases not in the current config before calling ssh -G - Add test for deleted alias edge case - Fix workspace-target fallback to honor explicit host selection * fix(ssh): let tombstoned aliases be re-picked in the config picker Allow users to reclaim a deleted SSH host by re-picking it from ~/.ssh/config. Tombstoned aliases now appear in the picker with a "Removed from Orca" badge and remain pickable, but don't count toward "Add all" operations — ensuring passive import never resurrects a deleted alias while still giving the user a recovery path.
Summary
Adds an in-dialog picker for ~/.ssh/config hosts when adding a new SSH target. Instead of a separate bulk-import flow, users can now browse and select a single config host to prefill the add-host form, completing the import workflow.
Changes
Backend
ssh:listConfigHostsandssh:resolveConfigHostfor querying and resolving config entriesSshConnectionStore.listSuppressedSshConfigAliases()to track deleted/suppressed config aliasesUI
AddRemoteHostDialoginto form view and config-picker view (same dialog shell, no resize jitter)AddRemoteHostSshConfigPickercomponent with search, filtering, and "In Orca" badgesAddRemoteHostSshFormPanelandAddRemoteHostServerFormPanelto encapsulate each modegetEditingTargetFromSshConfigHost, preserving all config identity fields (identity files, GSSAPI, proxy settings)Workspace creation
Validation
Testing