Repository navigation
fix(ssh): preserve interrupted installation outcomes through retries - #23273
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughRemote SSH install, deployment, lock, and garbage-collection paths now distinguish unconfirmed command termination from other failures. Unconfirmed termination errors propagate instead of triggering fallback results or further cleanup commands. Cache collectors use guarded moves and reference checks, and attempt to restore renamed entries when scans fail or find references. Tests cover confirmed and unconfirmed outcomes across Linux and Windows paths. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to The new Orcad GC test is expected to fail, blocking the SSH test workflow. Correct its classifier mock before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The reviewed paths generally preserve locks and staged files, stop cleanup after uncertain remote operations, and wait for overlapping work before retrying. No introduced security exposure was established, but recovery behavior and incomplete coverage leave some uncertainty. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
ℹ️ Minor suggestions only — one latent native-deps cache data-loss path worth hardening.
Reviewed changes
- Uncertainty propagation across all SSH install/GC paths — adds
isUnconfirmedSshCommandTermination(...) → rethrowto the best-effort catches inorcad-remote-install.ts,orcad-remote-gc.ts,remote-install-gc.ts,ssh-relay-gc-claim.ts,ssh-relay-gc-tombstone.ts,ssh-relay-install-lock.ts,ssh-relay-repair-lock.ts,ssh-relay-ripgrep-cache-gc.ts,ssh-relay-ripgrep-install.ts,ssh-relay-superseded-endpoints.ts,ssh-relay-versioned-install.ts. Confirmed failures keep their prior fallbacks. - Deploy orchestration (
ssh-relay-deploy.ts) —resolveRelayBootstrapStateno longer aborts the admitted sibling probe on a session-limit error and now surfaces an unconfirmed sibling rejection; the upload/lock/promote block is flattened to one outer catch that setsuploadStageCleanupAllowed = !unconfirmed;launchRelaymoves outside the launch try,launchLivenessObservedis replaced bylaunchCleanupSettled, and background cleanup is now gated onPromise.all([ripgrepInstall, runtimeInstall])so it is serialized behind both installers on all transports. - Native-deps cache GC — tombstone prefix renamed
.gc-tombstone.→.native-gc-(legacy still read) so older clients' mtime-only sweep can't delete new tombstones; the shell listing now returns tombstones instead of sweeping them in-shell; GC restores a referenced tombstone and removes an unreferenced abandoned tombstone without re-renaming.restoreRemoteTreeCommandis extracted tossh-remote-commands.ts(POSIX now also refuses a dangling-symlink destination) and replaces the removedrestoreEntryCommand. - Tests — new fault-injection suites across install lock, GC claim, repair lock, versioned install, orcad install, ripgrep install/cache, superseded endpoints, plus real-shell POSIX transactions for the native cache.
The concurrent-bootstrap, launch-fence, and stage-cleanup changes were traced against the old behavior: cleanup is strictly more serialized, unconfirmed fence/claim failures are preserved for stale recovery, and the error-precedence shifts are the stated intent. One finding below.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior pullfrog review (597ba83): commit 50554f349c, which hardens the native-deps and ripgrep cache collectors against a clock step during GC.
- Stamped tombstone identity at parse time —
parseCacheEntryListing(ssh-relay-native-deps-cache-gc.ts) now returns{name, key}[]andparseEntries(ssh-relay-ripgrep-cache-gc.ts) returns{name, entry}[], deriving the key/entry once where the listing is parsed. The GC loops consume that stamped value instead of recomputing theDate.now()-dependentstaleTombstoneKey/staleTombstoneEntryafter the awaited reference scan, so a backward wall-clock step can no longer reclassify an admitted tombstone and bypass its reference check. - Real-shell clock-step regressions — both
-real.test.tssuites now mockDate.now()to step backward while the reference scan runs, and assert the referenced tree is restored and preserved. These fail against the pre-fix code, so they genuinely cover the finding.
The prior inline thread on ssh-relay-native-deps-cache-gc.ts:114 was addressed by this commit and is already resolved; no remaining concerns. config/scripts/hourly-build-version.test.mjs appears in commit 50554f349c but is net-zero against main and therefore not part of the PR diff.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 779ab66e-aa2f-449a-ac16-74385a458334
📒 Files selected for processing (34)
src/main/ssh/orcad-remote-gc.test.tssrc/main/ssh/orcad-remote-gc.tssrc/main/ssh/orcad-remote-install-termination.test.tssrc/main/ssh/orcad-remote-install.tssrc/main/ssh/remote-install-gc-termination.test.tssrc/main/ssh/remote-install-gc.tssrc/main/ssh/ssh-relay-deploy-staged-upload.test.tssrc/main/ssh/ssh-relay-deploy-windows-pipe.test.tssrc/main/ssh/ssh-relay-deploy.test.tssrc/main/ssh/ssh-relay-deploy.tssrc/main/ssh/ssh-relay-gc-claim-termination.test.tssrc/main/ssh/ssh-relay-gc-claim.tssrc/main/ssh/ssh-relay-gc-retry.test.tssrc/main/ssh/ssh-relay-gc-tombstone.tssrc/main/ssh/ssh-relay-install-lock-termination.test.tssrc/main/ssh/ssh-relay-install-lock.tssrc/main/ssh/ssh-relay-native-deps-cache-commands.tssrc/main/ssh/ssh-relay-native-deps-cache-gc-real.test.tssrc/main/ssh/ssh-relay-native-deps-cache-gc.tssrc/main/ssh/ssh-relay-native-deps-cache.test.tssrc/main/ssh/ssh-relay-native-deps-cache.tssrc/main/ssh/ssh-relay-repair-lock-termination.test.tssrc/main/ssh/ssh-relay-repair-lock.tssrc/main/ssh/ssh-relay-ripgrep-cache-gc-commands.tssrc/main/ssh/ssh-relay-ripgrep-cache-gc-real.test.tssrc/main/ssh/ssh-relay-ripgrep-cache-gc.tssrc/main/ssh/ssh-relay-ripgrep-install.test.tssrc/main/ssh/ssh-relay-ripgrep-install.tssrc/main/ssh/ssh-relay-superseded-endpoints.test.tssrc/main/ssh/ssh-relay-superseded-endpoints.tssrc/main/ssh/ssh-relay-versioned-install-termination.test.tssrc/main/ssh/ssh-relay-versioned-install.test.tssrc/main/ssh/ssh-relay-versioned-install.tssrc/main/ssh/ssh-remote-commands.ts
💤 Files with no reviewable changes (1)
- src/main/ssh/ssh-relay-ripgrep-cache-gc-commands.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior pullfrog review (50554f3): the merge of main (7ba47f50, no src/main/ssh change) and commit 3544e8f6, "claim abandoned cache trees before recovery".
- Claim-by-rename in both cache GCs —
recoverAbandonedTombstonenow renames an abandoned tombstone to a fresh random name (ownedTombstonePath:randomInt(1, 2**47)+Date.now()) before any restore or delete, so only the pass whose rename wins acts on it;collectOwnedTombstonerechecks references under the rename and restores when referenced or the scan is unreadable, else deletes. The fresh name sits outside the 30-minutestaleTombstoneKey/staleTombstoneEntrywindow, andmoveRemoteTreeCommandanswersMOVED/BUSY, so a losing pass returns without deleting. - Native completion-marker discipline —
ssh-relay-native-deps-cache-commands.tsaddsrestoreRelayNativeDepsCacheTombstoneCommand(requires.deps-completeand an absent destination),dropRelayNativeDepsCacheCompletionMarkerCommand, andremoveRelayNativeDepsCacheTombstoneCommand(drop marker&&rm -rf). An interrupted deletion can no longer be restored as complete. Legacy.gc-tombstone.trees are deliberately unmarked before claiming and never auto-restored; the referenced-but-unrestorable outcome is asserted by the new real-shell tests. - Rethrow propagation — the native listing, reference-scan, move, and remove paths now rethrow
isUnconfirmedSshCommandTermination; the recheck error path attempts a self-restore then rethrows the scan error. - Tests — real-shell claim-race and interrupted-deletion regressions in both
-real.test.tssuites;startsWith('rm -rf')assertions relaxed toincludes('rm -rf')because the native removal command now begins with the marker-drop group. I ran the four directly affected suites (121 tests) and they pass.
The prior clock-step inline thread is resolved and the two candidate concerns a specialist surfaced (ripgrep lacks a native-style completeness marker; a shell-level restore/delete TOCTOU on the same tombstone) were validated and dropped: the ripgrep restore behavior is unchanged from the prior commit and its completeness is enforced downstream by the size-checking probe, and the TOCTOU needs a second actor on the same fresh name, which the fresh-name plus stale-window discipline precludes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
3544e8f to
310fa67
Compare
310fa67 to
9eeef0a
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — the split is coherent; one dead export left behind by the refactor.
Reviewed changes
This run re-reviewed the delta since the prior pullfrog review (3544e8f): the branch was force-pushed into a single commit that narrows the PR to the interrupted-install outcome propagation, moving the cache-recovery half to a stacked PR.
- Dropped the cache-recovery half — the native-deps claim-by-rename, the native tombstone shell commands, and the real-shell cache-recovery suites are gone; the native cache listing/parser reverted to the base implementation.
- One shared tree restore —
restoreRemoteTreeCommandinssh-remote-commands.ts(POSIX also refuses a dangling-symlink destination) replacesmoveRemoteTreeCommand/restoreEntryCommandin both cache collectors. - Retained the uncertainty propagation and deploy orchestration — the
isUnconfirmedSshCommandTermination → rethrowwiring across install locks, GC claims, repair locks, versioned installs, ripgrep install/cache, orcad install/GC, and superseded endpoints is unchanged, as is the deploy launch-fence and cleanup serialization. - Verified locally — the seven new
*-terminationsuites (245 tests) and eight affected deploy/cache suites (209 tests) pass against this head.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
When an SSH installation times out, its remote command may still be running. Orca now keeps that uncertainty through its retry and cleanup paths, preventing conflicting retries or removal of files the command may still use.
What Changed
Why
Best-effort catches previously erased the transport error that prevents unsafe retries. Carrying that existing information fixes the decision without a new scheduler or wire protocol.
This is 1 of 2 split PRs. Cache listing, abandoned-cache claims, legacy recovery, and completion-marker changes belong to the stacked cache-recovery PR #23281. This PR is independently buildable and tested; merge it first.
Linked Issue
No existing issue. Follow-up to #23128; split from the previously reviewed combined #23273.
Visual Proof
N/A — SSH installation and cleanup logic; no rendered UI changes.
Testing
Review
The original combined implementation passed full CI and Codex/Opus review. Both split PRs received fresh independent Codex and Claude Opus review; no blockers found. The combined source tree is unchanged. An unused restore-command deletion was moved into this first PR after review.
Agent skill upstream boundary
Notes
Uncertain GC claims remain until the existing stale-recovery window. Unconfirmed sibling termination can take diagnostic precedence over an earlier bootstrap failure; an optional pre-launch timeout may stop that connect rather than assume the command ended. These safety tradeoffs are intentional. Confirmed optional failures retain their fallbacks. No package split, wire change, tracking document, or migration change.
Checklist