Repository navigation
fix(ssh): stop an unanswered native-deps probe from wiping a healthy relay - #17979
Conversation
probeRequiredNativeDeps mapped any thrown error to available:false, which both triggered the repair and fed resetDeps — so one dropped exec channel rm -rf'd node_modules/node-pty on a healthy relay and forced a node-gyp source build. Verdicts are now ok / blocked / unverifiable; only an answered probe may repair, and only an answered probe may name reset deps.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Probe verdict tri-state —
probeRequiredNativeDepsnow returns{ status: 'ok' | 'blocked' | 'unverifiable'; missing }instead of{ available: boolean; missing }. A probe that throws (torn channel, timed-outrequire()) maps tounverifiablewith an emptymissing, rather thanavailable: falsewith every dep named — which is what used to triggerrm -rf node_modules/node-ptyon a healthy relay. - Repair gating — only
blockedperforms repair;unverifiabletakes the existing no-repair (healthy) exit, and a locked re-probe that can't answer falls back to the initial probe's answeredmissingset instead of widening the reset to all deps. - Regression spec — a new
ssh-relay-native-deps-probe-verdict.test.tspins four probe-verdict behaviors, including two (an unanswered health probe, and an unverifiable re-probe) that fail against the old code.
The fix is correct and minimal: the only behavioral delta is unverifiable moving from the repair branch to the healthy branch, and the acquired/busy/error lock-ownership handling is preserved by reusing the existing status !== 'blocked' exit (verified — an unverifiable probe with an acquired lock holds it exactly like the ok case, no leak). The missing: [] on unverifiable is never read, so no empty-reset path exists.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| return { available: false, missing: [...RELAY_NATIVE_DEP_NAMES] } | ||
| // Why: an unanswered probe says nothing about the deps; reporting MISSING here reset and | ||
| // recompiled healthy relays, turning one dropped exec channel into a multi-minute reconnect. | ||
| return { status: 'unverifiable', missing: [] } |
There was a problem hiding this comment.
An unanswered probe is now swallowed with no log, so a dropped exec channel during the health probe leaves zero trace and the relay simply launches — previously it surfaced loudly via the Repairing missing native deps warning plus a visible build. The install-path sibling surfaces the same failure (a throw that its callers log as [NATIVE-DEPS-REBUILD-FAIL] / [NPTY-MISSING]); a console.warn here would keep a real transport failure from being invisible.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughSSH relay native-dependency probing now returns Merge Risk: ⚪ Minimal · up to The change prevents unanswered SSH dependency probes from triggering destructive reinstalls while preserving repair for confirmed dependency failures. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is detailed, relevant, and covers the problem, rationale, implementation, scope boundaries, issue reference, sequencing, and testing results. It does not use every template heading and does not explicitly provide the required Visual Proof N/A statement or checklist confirmations, but the substantive information is mostly complete.
✨ 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 |
Resolves the probe-verdict conflict toward main's landed #17979 vocabulary (status: ok|blocked|unverifiable), which is strictly better: it repairs on any non-ok status and carries the initial probe's answered evidence forward when a locked re-probe cannot answer. Keeps this branch's unique PowerShell $LASTEXITCODE guard on the probe: a native non-zero exit does not throw in PowerShell, so the catch never fires and the probe would otherwise return empty, markerless stdout.
#17979) probeRequiredNativeDeps mapped any thrown error to available:false, which both triggered the repair and fed resetDeps — so one dropped exec channel rm -rf'd node_modules/node-pty on a healthy relay and forced a node-gyp source build. Verdicts are now ok / blocked / unverifiable; only an answered probe may repair, and only an answered probe may name reset deps. (cherry picked from commit 02ffd40)
…#18011) The repair path read "the probe answered, but nothing in the answer names a dep" as "both deps are missing". The POSIX probe is fenced with `|| echo MISSING`, so the subshell always exits 0 and the unanswered-probe catch added by #17979 never ran. A node that cannot start (invalid NODE_OPTIONS, OOM kill, exit 127) therefore produced a bare `MISSING`, and every reconnect rm -rf'd node_modules/node-pty and node_modules/@parcel/watcher and burned a 240s npm install that failed the same way. `.install-complete` from the original install survives, so the relay kept launching with no PTY and no file watcher, permanently, per host. Only a marker line that actually names deps is evidence about them; anything else is `unverifiable` and launches as-is. Also drop `2>/dev/null` from the POSIX probe and carry stderr into the warning via a new execCommand `onStderr` hook, so the reason node failed survives. stderr stays its own stream — folded into stdout it would match the probe's own token strings. The Windows branch shared the same parser and is fixed with it.
…lently The wrongful rebuild used to be the only visible symptom of a dropped exec channel; #17979 removed it, so a real transport failure now leaves no trace. Matches the install-path sibling, whose callers log the same class of failure.
…lently (#18000) * fix(ssh): log an unanswered native-deps probe instead of launching silently The wrongful rebuild used to be the only visible symptom of a dropped exec channel; #17979 removed it, so a real transport failure now leaves no trace. Matches the install-path sibling, whose callers log the same class of failure. * fix(i18n): restore the activity-options key the rebase dropped * fix(i18n): union en.json with main so the rebase cannot drop keys
stablyai#17979) probeRequiredNativeDeps mapped any thrown error to available:false, which both triggered the repair and fed resetDeps — so one dropped exec channel rm -rf'd node_modules/node-pty on a healthy relay and forced a node-gyp source build. Verdicts are now ok / blocked / unverifiable; only an answered probe may repair, and only an answered probe may name reset deps.
stablyai#17979) probeRequiredNativeDeps mapped any thrown error to available:false, which both triggered the repair and fed resetDeps — so one dropped exec channel rm -rf'd node_modules/node-pty on a healthy relay and forced a node-gyp source build. Verdicts are now ok / blocked / unverifiable; only an answered probe may repair, and only an answered probe may name reset deps. Mirror-Of: 02ffd40
…stablyai#18011) The repair path read "the probe answered, but nothing in the answer names a dep" as "both deps are missing". The POSIX probe is fenced with `|| echo MISSING`, so the subshell always exits 0 and the unanswered-probe catch added by stablyai#17979 never ran. A node that cannot start (invalid NODE_OPTIONS, OOM kill, exit 127) therefore produced a bare `MISSING`, and every reconnect rm -rf'd node_modules/node-pty and node_modules/@parcel/watcher and burned a 240s npm install that failed the same way. `.install-complete` from the original install survives, so the relay kept launching with no PTY and no file watcher, permanently, per host. Only a marker line that actually names deps is evidence about them; anything else is `unverifiable` and launches as-is. Also drop `2>/dev/null` from the POSIX probe and carry stderr into the warning via a new execCommand `onStderr` hook, so the reason node failed survives. stderr stays its own stream — folded into stdout it would match the probe's own token strings. The Windows branch shared the same parser and is fixed with it. Mirror-Of: 4f4872c
stablyai#17979) probeRequiredNativeDeps mapped any thrown error to available:false, which both triggered the repair and fed resetDeps — so one dropped exec channel rm -rf'd node_modules/node-pty on a healthy relay and forced a node-gyp source build. Verdicts are now ok / blocked / unverifiable; only an answered probe may repair, and only an answered probe may name reset deps.
…stablyai#18011) The repair path read "the probe answered, but nothing in the answer names a dep" as "both deps are missing". The POSIX probe is fenced with `|| echo MISSING`, so the subshell always exits 0 and the unanswered-probe catch added by stablyai#17979 never ran. A node that cannot start (invalid NODE_OPTIONS, OOM kill, exit 127) therefore produced a bare `MISSING`, and every reconnect rm -rf'd node_modules/node-pty and node_modules/@parcel/watcher and burned a 240s npm install that failed the same way. `.install-complete` from the original install survives, so the relay kept launching with no PTY and no file watcher, permanently, per host. Only a marker line that actually names deps is evidence about them; anything else is `unverifiable` and launches as-is. Also drop `2>/dev/null` from the POSIX probe and carry stderr into the warning via a new execCommand `onStderr` hook, so the reason node failed survives. stderr stays its own stream — folded into stdout it would match the probe's own token strings. The Windows branch shared the same parser and is fixed with it.
…lently (stablyai#18000) * fix(ssh): log an unanswered native-deps probe instead of launching silently The wrongful rebuild used to be the only visible symptom of a dropped exec channel; stablyai#17979 removed it, so a real transport failure now leaves no trace. Matches the install-path sibling, whose callers log the same class of failure. * fix(i18n): restore the activity-options key the rebase dropped * fix(i18n): union en.json with main so the rebase cannot drop keys

Closes the destructive half of #17891's root cause. Land this before #17920 — see sequencing below.
ELI5
The relay's repair-path probe mapped any thrown error to "all native deps are missing":
available: falsedoes two things, and the second is the worse one:resetDeps→rm -rf 'node_modules/node-pty'→ full recompile (a node-gyp source build on Linux, which has no prebuild);So an unanswered probe against a perfectly healthy relay caused an unnecessary full reinstall plus source compile. That is a direct contributor to the report behind this sweep — "SSH relays … taking several minutes to connect." Loss of contact was being treated as proof of breakage, which
docs/reference/ssh-execution-boundary.mdforbids.The asymmetry that is the whole bug
The sibling probe already does this correctly.
probeInstalledNativeDeps(:1275) has no try/catch — the error bubbles, the deploy fails, the lock releases, a later reconnect retries. Two tests deliberately pin that policy, one named "lets a probe SSH-channel failure bubble up rather than silently mapping to MISSING."The discipline existed on the install path and was never applied to the repair path. That is the tenth instance in this sweep of a hazard guarded in one place and not its twin.
The fix
Return type goes from
{ available: boolean }to{ status: 'ok' | 'blocked' | 'unverifiable'; missing }, reusing the vocabulary and rationale already written out insrc/main/orcad/node-pty-precondition.ts:45-56: "a probe that times out or cannot spawn says nothing about node-pty, and refusing to boot on it would brick working hosts for a reason that was never established."{ status: 'unverifiable', missing: [] }— an unanswered probe can no longer name a single dep for reset.blockedrepairs. Unverifiable takes the existing no-repair exit.resetDeps = probe.status === 'unverifiable' ? initialProbe.missing : probe.missing.Point 3 is scope beyond the named catch, and it is load-bearing. Without it, an initial probe answering "only
@parcel/watcheris broken" followed by an unverifiable re-probe still widened the reset tonode-pty— the same defect, one call site over. It preserves repair for genuine breakage (the answered initial probe's evidence stands) while never letting an unanswered probe author a reset list.One deliberate deviation from the brief. I suggested routing unverifiable to the
lockResult === 'busy' | 'error'degraded exit. The implementation used the healthy-probe exit instead: forbusy/errorthe two are byte-identical, but the healthy exit also handlesacquiredcorrectly. Taking the busy/error exit under an acquired lock would returnownsInstallLock: falsewith anundefinedgcClaimToken, leaking the repair lock until stale recovery. The deviation is correct and my brief was wrong.Scope fences held
missingNativeDepsFromProbe(no marker line → all deps) is untouched. That path runs only when the probe answered and|| echo MISSINGfired, which genuinely means broken — resetting is correct there.isRelayAlreadyInstalledand throwsRelayDirectoryGcConflictError; underbusy/errorthe pre-existingacquireRelayLaunchGcFencethrows the same. Verified, not assumed.User-facing regressions
None expected. Negative controls: a probe answering bare
MISSINGstill resets both deps and runsfinalizeInstall; a probe answering OK still skipsnpm install; the two pinned tests atssh-relay-native-deps-install.test.ts:395and:428pass unchanged (that file is not in the diff — only 2 files changed).Behavior delta: an unanswered probe against a healthy relay used to cost a full
npm installplus a node-gyp build. It now costs one extra exec (the launch-namespace marker) and launches. If the deps really were broken, the next reconnect re-probes and repairs — no state is lost, only the destructive guess.Testing
New spec
ssh-relay-native-deps-probe-verdict.test.ts. Before → after:The test was restructured mid-implementation: it first failed only on fixture slot-drift (
Relay failed to start within 10s) — a true failure for the wrong reason. Asserting the repair-avoidance facts before the launch outcome makes the pre-fix failure name the actual defect, and the second test prints the offending command:pnpm test src/main/ssh→ 1798 passed / 16 skipped.tc:nodeclean.check:code-quality:changed0 new findings.check:max-lines-ratchetOK. The 3 heaviestsrc/main/ipc/ssh*consumers also run (37 passed) since the return shape changed.Sequencing
This should land before #17920. It touches no artifact, manifest, or content hash, so no host moves to a fresh install dir — it costs zero reinstalls. #17920 forces exactly one reinstall per host and adds a third 240s command to a budget that is already 720s inside a 900s bound. Landing the free fix first is strictly dominant, and it removes the runaway that #17920 would otherwise lengthen.