Repository navigation
fix(ssh): sync ~/.ssh/config on import and Manage open - #4899
Merged
Jinwoo-H merged 2 commits intoJun 8, 2026
Merged
Conversation
importFromSshConfig only inserted unknown hosts and never updated an
existing target, so a rotated port (or any changed config field) was
silently ignored on re-import. Make it an upsert: config-sourced targets
are refreshed in place, genuinely new hosts are inserted, and the SSH
Manage pane auto-syncs when it opens so changes appear without a manual
Import click.
A new optional SshTarget.source ('ssh-config' | 'manual') protects
user-created and user-edited targets from being overwritten by sync —
editing a target in the UI detaches it from config-sync. Unchanged
targets are skipped so a repeat sync performs no disk write. Editing a
target now also carries cleared optional fields (identity file, proxy
command, jump host) so removing a config-derived value actually deletes
it instead of silently keeping the stale value through the partial merge.
Resolves item #1 of stablyai#4684 (item #2 was fixed in stablyai#4860).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jinwoo-H
self-requested a review
June 8, 2026 21:41
Co-authored-by: Orca <help@stably.ai>
Jinwoo-H
approved these changes
Jun 8, 2026
Jinwoo-H
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this fixes the stale SSH config import path nicely.
I made one follow-up fix before shipping: legacy targets without the new source field are now only adopted into config sync when they match the old config-import shape. That keeps older manual targets from being silently overwritten when the SSH Hosts pane auto-syncs on open.
Validated with targeted tests, typecheck, lint, and an Electron run covering auto-import, rotated-port update-in-place, and manual-edit protection.
|
Thanks! |
This was referenced Jun 25, 2026
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
* fix(ssh): sync ~/.ssh/config on import and Manage open
importFromSshConfig only inserted unknown hosts and never updated an
existing target, so a rotated port (or any changed config field) was
silently ignored on re-import. Make it an upsert: config-sourced targets
are refreshed in place, genuinely new hosts are inserted, and the SSH
Manage pane auto-syncs when it opens so changes appear without a manual
Import click.
A new optional SshTarget.source ('ssh-config' | 'manual') protects
user-created and user-edited targets from being overwritten by sync —
editing a target in the UI detaches it from config-sync. Unchanged
targets are skipped so a repeat sync performs no disk write. Editing a
target now also carries cleared optional fields (identity file, proxy
command, jump host) so removing a config-derived value actually deletes
it instead of silently keeping the stale value through the partial merge.
Resolves item stablyai#1 of stablyai#4684 (item stablyai#2 was fixed in stablyai#4860).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(ssh): preserve legacy manual targets during config sync
Co-authored-by: Orca <help@stably.ai>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes item #1 of #4684 (remote server / SSH config sync). Item #2 (directory refresh) was fixed separately in #4860.
Importing from
~/.ssh/configpreviously only inserted hosts that didn't already exist —importFromSshConfigbuilt a set of existing aliases purely to skip them and never updated an existing target. So when a host kept its name but its port changed (the temp-cluster workflow in #4684, where ports rotate each session), clicking Import silently left the stale port in place. The page also never auto-synced.This change:
importFromSshConfigan upsert — an existing config-sourced target has its config-derived fields (host,port,username,identityFile,identityAgent,identitiesOnly,proxyCommand,jumpHost) refreshed in place; genuinely new hosts are inserted; unchanged targets are skipped (no write).SshTarget.source('ssh-config' | 'manual'). Manual targets are never overwritten by sync, and editing a target in the UI detaches it (re-stamps itmanual) so a later sync can't silently revert a user's edit. Legacy persisted targets (nosource) are adopted into config-sync the first time they match a config host.Screenshots
Visual change: the Import toast now reads
Synced N server(s)/~/.ssh/config already in sync(wasImported N host(s)), and the pane refreshes from config on open.Testing
pnpm lint— clean (no new warnings in changed files)pnpm typecheck— clean (all three TS projects)pnpm test— added/updated tests pass; one pre-existing, unrelated failure (loads legacy pane aliases from very large persisted split layouts, a 130k-leaf perf stress test) times out locally and is untouched by this changepnpm build(build:desktop) — cleanNew/updated tests:
ssh-connection-store.test.ts: updates an existing config-sourced target when the port changed (primary regression); refreshes host/username/jumpHost; never overwrites a manual target; adopts a legacy unsourced target; no-op when unchanged;addTargetstampsmanualby default.persistence.test.ts:sourcesurvivesadd/update/getSshTargetand a disk round-trip (guards againstnormalizeSshTargetever stripping it); plus a real-Storeintegration test driving the full upsert through the realnormalizeSshTarget+ a disk flush/reload — insert → rotated-port update-in-place → third-sync no-op → exactly one target on disk → survives reload.Full SSH-subsystem baseline (canonical
config/vitest.config.ts): 582/583 passing across 43 SSH test files; 0 regressions. The one failure (ssh-config-loader › expands glob includes in lexical order) is pre-existing and environmental — it reproduces unchanged onorigin/mainand this change does not touch the config loader/parser.AI Review Report
Reviewed with two independent AI passes (adversarial code reviewer + NotebookLM):
join(homedir(), '.ssh', 'config'); no OS branching, shortcuts, or platform-specific paths touched.~/.ssh/config; makes no assumption that connection targets are local. No change to relay/ssh -Gresolution.~/.ssh/configonce per pane open; the no-op guard skips all disk writes when nothing changed, so repeated opens are no-ops.source: 'manual'; (2) editing a target to clear an optional field (identity file, proxy command, jump host) silently kept the old value through the partial-merge update — fixed by carrying cleared fields explicitly on the edit path so the removal takes effect. Added a defensive within-pass alias guard so a duplicate candidate can never create a duplicate target.Security Audit
No new attack surface. The
ssh:importConfigIPC handler takes no arguments. Values originate from a file the user already controls (~/.ssh/config); parsing is unchanged andssh -Gresolution (already---guarded) is untouched.ProxyCommandis stored as data, not executed by this change. No new input handling, path traversal, secret, or command-execution surface introduced.Notes
Hostentry in~/.ssh/configreserves that alias — the config host won't import under the same name. Legacy targets created before thesourcefield that happen to share an alias with a config host are adopted into config-sync on next import. Both are low-likelihood and the conservative (non-clobbering for explicit manual targets) behavior is intentional.Hostblock is later removed from~/.ssh/configare not auto-deleted — auto-removing targets on every pane open would be a destructive default. Pruning can be added later behind an explicit action.