Repository navigation
Stop reporting supported Linux hosts as an unsupported remote platform - #12209
Conversation
detectRemoteHostPlatform collapsed a refused session channel, an exec timeout, a non-zero exit and marker-less banner output into the same `null`, which ssh-relay-deploy.ts:362 rendered as "Unsupported remote platform" — so a fully supported linux-x64 host was blamed for being unsupported and nothing about the real cause was logged. The probe now classifies its outcome (detected / unsupported / unparsed / failed) and reserves `null` for a uname that genuinely parsed to an unsupported platform. Everything else throws with the underlying cause or the raw probe output, and logs a longer whitespace-collapsed tail. The Windows fall-through is unchanged, including the second attempt after a session-limit refusal, which gets its own session-channel retry budget. Closes #11104
📝 WalkthroughWalkthroughRemote platform detection now uses structured outcomes for detected, unsupported, unparsed, and failed probes. It preserves transport errors, handles cancellation and unconfirmed SSH termination, truncates diagnostic output, and applies prioritized error reporting. Uname and PowerShell probes return structured failures. Tests now cover retries, channel refusals, cancellation, malformed output, error precedence, unsupported platforms, output truncation, and Cygwin fallback to PowerShell. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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: 1
🧹 Nitpick comments (1)
src/main/ssh/ssh-remote-platform-detection.ts (1)
17-17: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake the timeout matcher tolerate fractional seconds.
execCommandformats the timeout message with${timeoutMs / 1000}s. A non-multiple of 1000 produces1.5s, which/timed out after \d+s$/udoes not match. The timeout then loses transport precedence inundetectedPlatformError.♻️ Proposed regex change
-const EXEC_TIMEOUT_MESSAGE = /timed out after \d+s$/u +const EXEC_TIMEOUT_MESSAGE = /timed out after \d+(?:\.\d+)?s$/u
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e60ede67-71ca-4bdb-9e4b-26827d6689fe
📒 Files selected for processing (2)
src/main/ssh/ssh-remote-platform-detection.test.tssrc/main/ssh/ssh-remote-platform-detection.ts
An unmappable uname (Cygwin on a Windows OpenSSH host) is only settled by the PowerShell probe, but the unsupported short-circuit ran before that probe outcome was inspected — so a MaxSessions refusal was discarded and a win32-x64 host was reported as an unsupported platform. Co-authored-by: Orca <[email protected]>
Summary
Connecting to a perfectly supported Linux x86_64 host could fail with
Unsupported remote platform. Orca relay supports: linux-x64, ..., and nothing in the logs said why.detectRemoteHostPlatformcollapsed four very different outcomes into a singlenull:src/main/ssh/ssh-remote-platform-detection.ts:36swallowed every non-abort failure of theunameprobe (a session channel refused pastMaxSessions, the 30s exec timeout, a non-zero exit, a transport drop),:59did the same for the PowerShell fall-back probe, andparseRemotePlatformOutputat:65dropped the remote's raw stdout on the floor when no marker line was found (restricted shell /ForceCommand).src/main/ssh/ssh-relay-deploy.ts:363-366(reached from the sole call site at:362) then turned every one of thosenulls into the hardcoded "Unsupported remote platform" message. Those line numbers are on the base commit,c9a37f5.The probe now classifies its outcome —
detected/unsupported/unparsed/failed— andnullis reserved for the one case the message is actually true for: a marker line that parsed but named a platform the relay does not ship (e.g.FreeBSD x86_64). Everything else throws:Could not detect the remote platform: (SSH) Channel open failure: open failed), with the original error attached ascause. This is deliberate: on a Windows remote whose PowerShell probe is refused, the old ordering would have surfaced theunameprobe's mundane non-zero exit instead —Command "printf '\n%s ' '__ORCA_REMOTE_PLATFORM__'; uname -sm" failed (exit 127): sh: not found— and told the user their Windows box is missing a shell;unameprobe's error, then its unrecognized output, then the PowerShell probe's error;…when truncated) soForceCommand/banner cases are actionable.One
console.warnon the failure path carries a longer (1000-char) tail of whatever the remote actually printed — the diagnostic that was missing when #8324 (same symptom, still open) was triaged.The Windows fall-through is preserved for every ordinary
unamefailure, including a session-limit refusal:SshConnection.execroutes throughopenSessionChannelWithRetryon the ssh2 transport, so probe 2 gets its own retry-with-backoff budget after probe 1's channel slot is released. There is exactly one new case where the PowerShell probe is skipped: theunameprobe rejected with anAbortError, or with an error whose channel close was never confirmed (sshChannelCloseConfirmed === false— the system-ssh timeout/abort/stream-error path). An ordinary non-zero exit never carries that flag, so a Windows remote answeringsh: not foundstill falls through exactly as before.ssh-relay-deploy.tsis unchanged.Closes #11104
ELI5
Orca asks your remote machine "what kind of computer are you?" before it installs its helper. If that question failed for any reason at all — the server was too busy to open another channel, the answer timed out, the login banner ate the reply — Orca shrugged and told you "your computer isn't supported", even when it was a completely ordinary Linux machine. That message was almost always a lie, and it hid the real problem.
Now Orca tells you what actually went wrong, and shows you what the remote machine really printed back. It only says "unsupported" when the machine genuinely answered with a platform Orca has no helper for.
Fix proof
Before — from a scratch repro file run against
main(ssh-remote-platform-detection.bug-11104.test.ts; it is deliberately not part of this diff, both of its cases were folded into the real suite):After — both repro cases now live in
src/main/ssh/ssh-remote-platform-detection.test.tsalongside 9 more classification cases (11 newits; the file goes from 6 to 17 tests):No regressions
Every SSH suite plus the SSH IPC suite (
src/main/ssh/,src/main/ipc/ssh.test.ts) — this coversssh-relay-deploy,ssh-relay-native-deps-install,ssh-relay-sftp-namespace-install,ssh-relay-gc-retry,ssh-relay-cross-version-isolation,ssh-remote-platform,relay-protocoland the rest:src/shared/process-output-field-scanner.test.ts(the parser this file consumes):Test Files 1 passed (1) / Tests 5 passed (5).CI: currently green — no failing checks on head
7aad524. The first attempt of the PR Checks run had exactly one red check, shardtests node 26 15/16, failingsrc/renderer/src/components/activity/activity-portal-readiness-loop.react185.test.tsx > releases a latched readiness once the terminal attacheswithexpected 'unavailable' to be 'ready'. That is the repo-wide happy-domMutationObserverflake (the test's own comments note that "under CI load MutationObserver may miss one replaceChildren"); it is a renderer test with no connection to this main-process SSH diff, and the identical failure hit unrelated branch #12212 the same day. The re-run passed with no code change.Trade-offs
MaxSessions, fixForceCommand, install/bin/sh). That is the point, but it is a change in tone.execCommandmocked throughout — run locally on macOS and on Linux (ubuntu-latest) in CI. No live SSH connection, no real Windows or Cygwin remote, and noMaxSessions-saturated sshd was exercised end to end; the session-limit, timeout and unconfirmed-close shapes are reproduced from the error objects those code paths construct, not from a real server.Cross-platform
Main-process Node only. No keyboard handling, no
metaKey, no Electron accelerators, no shortcut labels, no path construction (joinRemotePathandgetRemoteHostPlatformare untouched), no UI code. Identical behavior on macOS, Linux and Windows clients.Remote-side platform handling is the subject of the change and is preserved for all six relay targets: POSIX remotes via the unchanged
uname -smprobe (same command string, still asserted by the existing test), Windows remotes via the unchanged PowerShell fall-back (still reached whenever theunameprobe fails to detect, including its/bin/shnon-zero exit; stillwrapCommand: false, same-EncodedCommandpayload). The one new gate on that fall-back is the abort / unconfirmed-close short-circuit described in the summary. The newunsupportedclassification deliberately runs afterdetectedon both probes, so a Cygwin remote whoseuname -sreportsCYGWIN_NT-10.0still falls through to PowerShell and is detected as win32 — covered by a new test. CRLF is handled byiterateProcessOutputLines, and the summarizer collapses both CR and LF so a Windows banner cannot produce a multi-line message.SSH-remote: this is entirely the SSH path; nothing here assumes local execution. Both transports are covered because the change sits downstream of
execCommandand only reclassifies its rejections — ssh2 (conn.exec→openSessionChannelWithRetry) and system-ssh (conn.exec→spawnTrackedSystemSshCommand, which has no session-channel retry of its own). The "unconfirmed channel close" short-circuit is transport-aware by construction:execCommanddeliberately leavessshChannelCloseConfirmedfalse for system-ssh channels because a local OpenSSH child exit does not prove the remote command stopped, so on system-ssh we skip a probe that would race a still-held ControlMaster slot.Folder workspaces (non-git): platform detection runs before any workspace exists. No git command is added, changed or version-gated; no
GitCapabilityCacheinteraction, no git-provider surface, no-c-leading git command affected.Performance
No new remote round trips. The happy path is byte-for-byte unchanged: a
detecteduname probe returns after exactly one exec, as before. One 30s exec is saved only where the first probe is abandoned: the unconfirmed-termination case (where the second probe was near-certain to be refused anyway) and anAbortErrorthat the caller's own signal does not already re-throw. No round-trip saving on session-limit — that "saving" would have been a lost retry, and is given back deliberately.summarizeProbeOutputruns at most twice per failed connect, on a string already bounded to 1 MiB byappendExecOutputTail; a single bounded pass on an error path only. No polling, no timers, no new spawns, no extra IPC (the error travels on the existingssh:connectreply —ssh-relay-deploy.ts:362is the only call site), no renderer re-renders.Security
No change to IPC surface, auth, or path handling. Command execution is unchanged — same two probe command strings, same wrapping flags. The one new exposure is diagnostic: up to 200 chars of the remote's own probe output in the thrown message and 1000 chars in the local log. It is the connecting user's own host output, shown only to that user; install-marker redaction is not needed because detection runs before any install marker exists, and
execCommandalready redacts marker tokens in its own non-zero-exit and timeout messages.AI Review Report
Reviewed by independent subagents in a loop until clean, across two hostile lenses — correctness/regressions and cross-platform + remote + performance.
Remediation applied between rounds: 1 pass(es) — it produced the second commit, which lets a refused PowerShell probe outrank an unmappable
uname, plus its test. Findings judged false-positive were rejected with evidence rather than coded around.Made with Orca 🐋