Repository navigation
fix: flag a config host whose machine is already registered under another name - #15750
kaluli123123 wants to merge 5 commits into
Conversation
…ther name
searchSshConfigHosts decided "already in Orca" by comparing normalized alias
strings — a target's configHost and label — against the config entry's Host
pattern. Two names for one machine therefore both pass:
manual { label: 'AI Box', configHost: '172.16.203.131', host: '172.16.203.131' }
picker Host aimp / HostName 172.16.203.131
Nothing in either record is string-equal, so the picker lists `aimp` as new and
the user gets a second target for a box they already added. Both connect to the
same endpoint and attach to the same relay daemon, so the two entries list the
same remote sessions and operating either one drives the same underlying ones.
Add sshEndpointIdentity — host, port and user, normalized and NUL-separated —
and treat a candidate as already registered when either its alias or its
endpoint matches. Multiple pathspecs of identity, same as before, just no
longer name-only.
Only entries carrying HostName participate: without it the candidate host
degrades to the alias itself, and matching on that would re-run the alias check
while letting unrelated aliases collide. That also bounds what this fixes —
a Host block that resolves through DNS rather than HostName still yields two
targets, because neither the parser nor `ssh -G` resolves names.
alreadyInOrca is a display flag, not a gate, so a deliberate second target for
the same endpoint (different identity file, different jump host) still gets
added — it just says so first.
Fixes stablyai#15478
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Pre-merge checks:
|
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: aba43e7a-416c-4e53-89ad-5bb5ebb7e9f0
📥 Commits
Reviewing files that changed from the base of the PR and between 59892a2 and e753003060fcf46306f5f7a99b07daba4eb35309.
📒 Files selected for processing (4)
src/main/ssh/ssh-config-host-picker.test.tssrc/main/ssh/ssh-config-host-picker.tssrc/shared/ssh-config-alias.test.tssrc/shared/ssh-config-alias.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
@coderabbitai review |
❌ Action failedReview failed.
|
|
8f51814 to
a5575ce
Compare
|
Merged current upstream main ( Validation:
Remaining gates: full build/full suite and native-platform UI validation are not claimed. The pinned Bun binary is unavailable with install scripts disabled, so typechecking used the supported native compiler. Previous failed workflow runs had zero jobs, not failing test executions; exact-head PR CI still needs to run and complete. AI review: endpoint comparison remains pure and platform-neutral; local/SSH behavior and supported agent/integration routing are unchanged. It adds no network requests or credential access. Native rendering has not been visually revalidated. |
|
Fixed an additional endpoint-identity bug in Validation: all 28 focused tests passed; a direct real OpenSSH parser → production picker smoke passed for both case-distinct users and hostname folding. All project typechecks, full lint, formatting and all seven changed-code quality gates passed. The built CLI help smoke and desktop/mobile-web build stages passed. The full test attempt was stopped at its 240-second limit after reporting six process-host development-rebuild test failures; it is not a full-suite pass and no baseline attribution is claimed. Full Follow-up validation: the earlier watcher failures were isolated to lexical The native packaging failure now has a concrete toolchain/layout diagnosis: this host's Swift 6.4 default reports |
|
Thanks @kaluli123123, this is the right shape for #15478: it's parser-only and doesn't spawn One change before we can merge. In the picker, Could you either:
Either works for us. A test with two entries that share a HostName but have different ProxyJump values would cover it. |
|
Addressed the route-identity concern from #15750 (comment) in a29d91e, together with integration of upstream main ee09f97. Endpoint identity now includes the saved jumpHost and proxyCommand in addition to hostname, port, and case-sensitive username. The parser-only picker supplies ProxyJump/ProxyCommand from each config entry; it still does not spawn ssh -G per row. Identical private endpoints through different jump hosts or proxy commands stay selectable, while the identical saved route remains marked In Orca. Alias/label matching, tombstones, hostname case folding, valid port boundaries, and case-sensitive SSH users are preserved. Added helper and production parser-to-picker regressions and updated the SSH guide. Validation on macOS: 80 focused tests passed; all four configured native-compiler project typechecks passed; a direct production OpenSSH parser → picker smoke verified identical saved routes and distinct jump/proxy routes. The required check:changed gate passed 22 of 23 checks, including its static/format/quality/typecheck gates. Its broader 573-file affected test selection reported 7,038 passing tests, eight failing PTY assertions, and three cross-version suites unable to resolve local release refs v1.4.190, v1.4.224, and v1.4.219. Independent controls with production sources pinned to ee09f97 have now reproduced each of those same eight specific PTY assertions, including the single materialization-race case; that does not classify the entire affected suite. After fetching those exact release refs, the three previously blocked cross-version suites completed successfully: 3 files and 57 tests passed with maxWorkers=1. The broader sweep was not repeated merely to reconfirm the controlled PTY failures. No full-wrapper pass is claimed. No real SSH endpoint, physical phone, Linux/Windows execution, native packaging, or manual/visual proof is claimed. Full validation and the exact-head .github/workflows/pr.yml aggregate PR checks passed remain required; exact-head PR Checks https://github.com/stablyai/orca/actions/runs/40634511395 reports action_required with zero executed jobs, while the successful clean job is from Clean obsolete PR work and does not satisfy that gate. The PR remains open and is not being presented as merge-ready. |
…35792) * fix(ssh): flag a config host whose route is already registered under another name The ssh-config picker compared names only, so a machine added by IP showed up again under its config alias. It now also compares the endpoint: hostname (case-insensitive), validated port, case-sensitive user, jump host and proxy command. Entries without HostName still match by alias only. Squashed from #15750 (3c3a3c6, a5575ce, 8daf213, a29d91e). * fix(ssh): skip importing a config alias whose ssh -G route is already in Orca Each config import now builds one snapshot: the config it read, and which new aliases resolve, through ssh -G, to a route an existing target already has. The duplicate check and the inserts both read only that snapshot. Imports and picker refreshes run one at a time through a single queue, so none can race another, and the picker reads the latest snapshot for its In Orca flags and Add all count without waiting (alias-only until one exists). A route is keyed only when ssh2's rules and system ssh's (OpenSSH run with system ssh's own destination args, including an unclaimed alias's stored endpoint) agree on host, port, user and proxy, with each transport's token rules. Anything uncertain, or a failed ssh -G, gives no key, so nothing is matched by guess. At most four ssh -G run at once. Restore brings back the hosts it lists, previouslyRemoved stays alias-only, and DNS isn't consulted. Co-authored-by: vam <[email protected]> * fix(ssh): rebuild the route snapshot after an import changes targets An import that inserts or updates a target outdates its own snapshot, which left the picker alias-only until the next refresh. It now queues a rebuild behind itself. The picker also ignores a snapshot past its reuse window, and the system-route shortcut requires a config alias. Co-authored-by: vam <[email protected]> --------- Co-authored-by: vam <[email protected]>
|
Thanks @kaluli123123! Your fix landed in #35792 with your authorship kept. You found that the duplicate came from comparing names, and that the route fields (jump host, proxy command) belong in the identity. We built on that: the config import now asks OpenSSH ( |
ELI5
Add a machine by IP, then open the ssh-config picker: the same box shows up as new, because Orca compared the names and
172.16.203.131is not the stringaimp. Now it also compares where the entry actually connects, so the picker says it is already there.What Changed
Endpoint identity is a NUL-separated tuple of case-insensitive hostname, validated port, case-sensitive SSH username, saved jump host, and saved proxy command. The parser-only picker passes each entry's
ProxyJumpandProxyCommandto that shared identity; it does not spawnssh -Gper row.searchSshConfigHostsmarks a rowalreadyInOrcawhen its alias/label or complete configured endpoint matches a saved target. Different users, ports, jump hosts, and proxy commands remain distinct. Entries withoutHostNameretain alias-only matching.Why
The duplicate check was name-only, so two names for one machine both pass:
Nothing there is string-equal. Both targets then connect to the same endpoint and attach to the same relay daemon, so they list the same remote sessions and operating either one drives the same underlying ones — from the UI it looks like clicking one host also clicks the other.
alreadyInOrcadisables a picker row and makes Add all skip it; it is an admission gate, not merely a display flag. The route fields prevent distinct private endpoints behind different jump hosts or proxy commands from being incorrectly blocked, addressing the maintainer request. This change does not add a non-blocking possible-duplicate UI or resolve DNS aliases.Scope: this does not cover the reporter's own config
Only entries carrying
HostNameparticipate in the endpoint check, guarded byentry.hostname. Without it,sshConfigHostsToTargetsdegrades the candidate host to the alias itself (entry.hostname || entry.host), and matching on that would both re-run the alias check and let unrelated aliases collide — there is a test pinning thatalpha/beta/gammastay unflagged.That bounds what this fixes. In #15478 the persisted record is:
{"label": "aimp", "configHost": "aimp", "host": "aimp"}hostlanded asaimp, not the IP — so thatHost aimpblock has noHostName, and the address resolves through DNS or/etc/hosts. The suggested fix of resolving throughssh -Gwould not close it either:ssh -G aimpechoeshostname aimpwhen noHostNameis configured, because it does not resolve names. Covering that case needs real name resolution in the duplicate check, which is network I/O whose answer moves with the environment — a separate decision, not something to fold in here.I have posted that finding on the issue.
Linked Issue
Related: #15478 — configured endpoint duplicate detection only; this does not claim to resolve the hostname-only/DNS case described below.
Visual Proof
Not attached. The duplicate decision changes row availability and bulk-add behavior. Parser/picker regressions and a production-module smoke are not before/after UI proof; real dialog/platform validation remains outstanding.
Testing
Three picker cases: same machine under a different label, flagged; a different machine, unflagged; config entries with no
HostName, still unflagged and non-colliding. Pure-function cases cover port defaulting and valid boundaries, NUL separation, hostname case folding, case-sensitive SSH usernames, empty/whitespace/missing hosts, and invalid ports falling back to 22.src/main/ssh+ new pure-function suite + IPC + sidebar consumerspnpm run typecheck(node + cli + web)Red to green: the "same machine, different label" assertion was written first and observed failing. The other two picker cases passed before and after — which is the point, since this widens the match rather than changing existing behaviour.
Historical verification recorded on 2026-10-21 (
8daf21370b, not the current head): 28 focused helper/picker regressions and a real OpenSSH parser → production picker smoke passed, including distinctAdmin/adminaccounts. All configured typechecks, full lint, formatting and seven changed-code quality gates passed. Desktop/mobile-web build stages and built CLI help passed. The full suite was attempted for 1800 seconds but did not finish; full native packaging failed at the Swift 6.4 output-layout mismatch. No full-suite or native-build pass is claimed. Exact diagnostics and remaining platform/SSH/UI/current-head CI gates are in the existing validation comment. These are historical executions, not a new test run on 2026-10-22.Unrelated flakiness observed:
src/renderer/src/components/sidebarfails a varying set of tests under concurrency (7 failures on one run, 3 on the next, all green when the file is run alone). Pre-existing and unrelated — these are renderer component tests with no path to the main-process picker — but flagging it rather than leaving a red run unexplained.Latest published-head validation, recorded on 2026-10-28 (
a29d91ea4a8ba962ddd4571d828cf2b78fcc1d53): 80 focused tests, all four project typechecks, and a production OpenSSH parser-to-picker smoke passed, including distinct jump/proxy routes.check:changedpassed 22 of 23 gates; the affected-test gate remained failed. The existing validation comment records the broader failures and pinned-production controls. These are historical results, not fresh 2026-10-29 executions. Full/native packaging, real SSH/platform/UI proof, and current-head PR Checks remain gates.AI Disclosure
Claude Opus 5 (via Claude Code) investigated, implemented, and verified this change.
Review
alreadyInOrcaonly. TheexistingTargetsparameter takes the three new fields asPartial, so callers that pass only names keep type-checking and behave exactly as before.Agent skill upstream boundary
Notes
Deliberately narrow: it does not touch
sshConfigHostsToTargets, whose empty-exclusion-set call is documented as intentional with reconciliation happening inssh-connection-store.ts, and it does not add merge/dedupe of already-persisted duplicates.One observation while reading:
existingAliasesalready collects bothconfigHostandlabel, so the reporter's own case — manual target labelledaimp, config aliasaimp— should have matched on the name alone. Either the manual target was labelled differently and the JSON was reconstructed afterwards, orexistingTargetsdid not include it at that moment. Worth a maintainer eye, since it may be a second, distinct defect in how the picker is fed.Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass — typecheck, oxlint and the affected suites pass locally; full-suite attempt incomplete and native packaging failed; see dated Testing updateGenerated with Claude Code