Repository navigation
fix(ssh): orcad GC honors the activation journal; readiness requires proven daemon coverage (#16741 T6) - #24451
Conversation
…proven daemon coverage (#16741 T6 follow-up) GC pins every slot an in-flight activation journal names and skips the pass entirely when a journal is unreadable or a fence is held without one. orcad's self-test now reports the coverage the daemon says its probe achieved, and remote readiness probes accept a slot only on pty-spawn coverage, or handshake on win32; builds without the field keep the identity gate.
|
| } | ||
|
|
||
| export async function gcOldOrcadVersions(options: OrcadGcOptions): Promise<void> { | ||
| const transaction = await readOrcadGcTransactionPins(options) |
There was a problem hiding this comment.
If a deployment finishes installing a candidate after GC reads the journal but before the deployment writes its activation journal, GC will not pin that candidate. The completed install no longer holds its per-version lock, so GC can remove the idle-looking slot. The deployment then cannot launch the version it just installed. The journal read needs to remain coordinated with activation through deletion.
Knowledge Base Used: Remote connectivity and execution
There was a problem hiding this comment.
ℹ️ No critical issues — one scope question inline, plus a stale doc reference.
Reviewed changes
- orcad GC honors the activation journal —
gcOldOrcadVersionsnow reads the activation journal and fence before the version pass;readOrcadGcTransactionPinspins every version an in-flightactivate/rollbacknames, and returnskeep-all(skipping the pass, including the node-runtime store pass) when the journal is unreadable, unanswered, or absent behind a held fence. Unconfirmed SSH termination still rethrows. - Readiness requires proven daemon coverage —
runTerminalDaemonSelfTestnow reports the daemon's owncoverageviacheckDaemonHealthWithCoverage, andgatedReadinessrejects ahandshake-only result on a non-win32 host through the neworcadDaemonCoverageRefusal. - Tests — new GC transaction-pin cases, coverage accept/reject cases for probe and launch, and a daemon-reported coverage case. Verified locally: all 43 tests in the three changed test files pass.
Technical details
# Coverage gate is applied on the probe/launch path but not the activation-commit path
## Affected sites
- `src/main/ssh/orcad-active-readiness.ts:62` — `orcadDaemonCoverageRefusal`, applied in `gatedReadiness` (used by `probeActiveOrcadReadiness` / `launchOrcadSlotAndAwaitReadiness`).
- `src/main/ssh/orcad-installed-activation.ts:226` — calls `evaluateOrcadActivation` directly; no coverage refusal.
- `src/main/ssh/orcad-rollback-transition.ts:205` — same.
- `src/main/ssh/orcad-activation-gate.ts:140` — still only warns on `selfTest.coverage === 'handshake'`.
## Required outcome
- Same verdict for the same payload on both surfaces, or an explicit statement that the split is intentional.
## Open questions for the human
- On POSIX, a daemon that reports `handshake` is rejected by recovery but would still be activated by the install path. Is that split intentional (activation is owned by another task), or should `evaluateOrcadActivation` consult `orcadDaemonCoverageRefusal` too?ℹ️ Stale function name in orcad-operations docs
docs/reference/orcad-operations.md:255 says the self-test "runs checkDaemonHealth against the daemon's socket". This PR switches runTerminalDaemonSelfTest to checkDaemonHealthWithCoverage, so the named function no longer matches. Worth updating while the coverage semantics are in hand.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| export function orcadDaemonCoverageRefusal(readiness: ServeReadiness): string | null { | ||
| const health = readiness.health | ||
| const coverage = health?.terminalDaemon?.selfTest?.coverage | ||
| if (!health || coverage === undefined || coverage === 'pty-spawn') { | ||
| return null | ||
| } | ||
| if (coverage === 'handshake' && health.platform === 'win32') { | ||
| return null | ||
| } | ||
| return ( | ||
| `reported terminal-daemon coverage '${String(coverage)}', which does not prove a PTY can ` + | ||
| `be created on ${health.platform}.` | ||
| ) | ||
| } |
There was a problem hiding this comment.
This platform-aware refusal only runs on the probe/launch path. The gate that commits an activation, evaluateOrcadActivation (called from orcad-installed-activation.ts:226 and orcad-rollback-transition.ts:205), still treats selfTest.coverage === 'handshake' as a warning (orcad-activation-gate.ts:140), so a POSIX host reporting handshake is rejected by recovery but would still be activated on install.
Technical details
# Coverage gate not applied to the activation-commit path
## Affected sites
- src/main/ssh/orcad-active-readiness.ts:62 — new refusal, wired into `gatedReadiness` only
- src/main/ssh/orcad-activation-gate.ts:140 — handshake still warning-only
- src/main/ssh/orcad-installed-activation.ts:226, src/main/ssh/orcad-rollback-transition.ts:205 — call the gate directly
## Open questions for the human
- Is this split intentional (activation owned by another task), or should `evaluateOrcadActivation` consult `orcadDaemonCoverageRefusal` so both surfaces agree?|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)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 (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe terminal daemon self-test now reports daemon-supplied health coverage, and readiness validation checks that coverage against the platform. Remote version GC now reads activation-transaction pins, combines them with existing pins, and skips the pass when transaction state cannot be resolved. Tests cover coverage handling, pending transactions, journal and fence states, and GC removal candidates. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The changes strengthen daemon readiness checks and protect in-flight versions during cleanup. No concrete merge-blocking issue is established; mergeability remains subject to normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The changes strengthen cleanup protection and readiness checks without a demonstrated new attacker-accessible boundary. However, activation and recovery apply different readiness policies, which could leave an interrupted operation requiring manual recovery. Actual deployment exposure remains unconfirmed. 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 |
* Revert "feat(orcad): source-side dormant export of a relay-hosted SSH target (#16741 T6-8) (#24519)" This reverts commit 783101b. * Revert "feat(ssh): update, roll back, recover and stop a managed orcad server (#16741 T6-5 follow-up) (#24463)" This reverts commit 38c2d1d. * Revert "feat(ssh): deploy and pair an empty managed orcad server over SSH (#16741 T6-5) (#24453)" This reverts commit 8b76683. * Revert "fix(ssh): orcad GC honors the activation journal; readiness requires proven daemon coverage (#16741 T6 follow-up) (#24451)" This reverts commit d3f8c50. * Revert "feat(ssh): remote orcad stop by request file and journaled decommission (#16741 T6-4) (#24449)" This reverts commit 43d9b43. * Revert "feat(orcad): supervisable server: stop requests, managed stop receipts and a lifetime that keeps its lock on failed teardown (#16741 T6-3) (#24433)" This reverts commit b093d3a. * Revert "feat(ssh): crash-safe orcad activation, rollback and recovery (#16741 T6-2) (#24423)" This reverts commit 1a9ac0e. * Revert "feat(runtime): SSH access links for paired servers in a downgrade-safe sidecar (#16741 T5-1+T5-2) (#24420)" This reverts commit 99db2bf. * Revert "feat(relay): capability-gated owner reset with a durable preparation journal (#16741 T3 R1) (#24418)" This reverts commit 34a582b. * Revert "feat(ssh): track connection-manager drains, test probes and provider continuations (#16741 T2 P3+P8a) (#24407)" This reverts commit d53063d. * Revert "feat(daemon): idle retirement, session census and recovery-only provider (#16741 T2 P4b) (#24409)" This reverts commit ff212db. * Revert "feat(ssh): add pty.resumeClient and split SSH PTY process listing (#16741 T2 P5+P6) (#24414)" This reverts commit 92cb717. * Revert "feat(relay): await owned watcher and agent children on shutdown (#16741 T2 P1) (#24400)" This reverts commit 6b36e4f. * Revert "feat(session): retry failed renderer session writes and verify local folder PTYs (#16741 T2 P9) (#24406)" This reverts commit d23ecef. * Revert "feat(ssh): remote orcad primitives on the pinned Node runtime (#16741 T6-1) (#24419)" This reverts commit dd87ae5. * Revert "fix(runtime): fence runtime-environment subscriptions and status probes by identity (#16741 T5-3) (#24421)" This reverts commit ece9e4d. * Revert "feat(orcad): migration manifest and dormant-state contracts (#16741 T6-7) (#24422)" This reverts commit 3fbdaba. * Revert "feat(ssh): wire SshConnection through the work and transport close ledgers (#16741 T2 P2) (#24401)" This reverts commit 4e8edc8. * Revert "feat(profiles): carry markdown frontmatter visibility in project transfers (#16741 T2 P7) (#24405)" This reverts commit 60c9326. * Revert "fix(runtime): project the PTY incarnation onto mobile session tabs (#24413)" This reverts commit 99e0303. * Revert "feat(daemon): tag daemon stream data with the PTY incarnation id (#16741 T2 P4a) (#24402)" This reverts commit 817af76. * Revert "feat(ssh): port the SSH connection work ledger and transport close ledger (#16741 T2) (#24210)" This reverts commit c991893. * Revert "feat(relay): fence and drain file and git response streams on shutdown (#24185)" This reverts commit dc08ffe. * Revert "refactor(runtime-rpc): extract the Node WebSocket lifecycle; opt-in pinned port (#24186)" This reverts commit a789233. * Revert "feat(relay): route relay handlers through work admission; producer publication drain (#24181)" This reverts commit 0b812bd. * Revert "feat(relay): land the #16741 T1 seam (work drain, publication drain, release gate) (#24156)" This reverts commit 3aa2d3a. --------- Co-authored-by: m4air <[email protected]>

ELI5
These are two safety fixes for managing the remote
orcadserver.Nothing calls this code in production yet, so users see no change.
What Changed
1. Cleanup reads the activation journal
New file:
orcad-gc-transaction-pins.ts.gcOldOrcadVersionsnow does two things before removing anything:orcad-state-snapshots/. Cleanup only ever listsorcad-<version>slot directories, so it never touches them; a test now covers this.2. Readiness requires proven terminal coverage
orcadside.runTerminalDaemonSelfTestnow callscheckDaemonHealthWithCoverage(#24409). SoselfTest.coveragereports what the daemon says its probe actually did, instead of a guess based on the platform.Client side.
probeActiveOrcadReadinessandlaunchOrcadSlotAndAwaitReadiness(orcad-active-readiness.ts) now accept a slot only when one of these holds:pty-spawn, meaning a real test terminal was created;handshakeand the host is win32, where the daemon never spawns a test terminal;Builds that don't report coverage keep today's check (build hash plus version), so older slots aren't stranded. A
handshake-only result on a POSIX host is rejected with the verdictrejected.Why
docs/reference/ssh-execution-boundary.md).Linked Issue
Part of the Node runtime plan (Phase 3), T6 exit-gate track (#16741). These close the T6-2 GC gap and the T6-1 readiness follow-up. Independent of #24449.
Visual Proof
N/A. There's no UI change and no production caller.
Testing
orcad-remote-gc.test.ts:orcad-remote-primitives.test.ts:pty-spawn,handshakeon win32, and a build without the coverage field;handshakeon Linux, for both probing an existing slot and launching a new one.orcad-health.test.ts: the self-test reports the coverage the daemon returns.Regression: every
src/main/orcadandsrc/main/sshtest plus the import-boundary test.Static checks:
node config/scripts/check-changed-code-quality.mjs origin/mainpasses. Atsc --noEmitrun limited to the changed files is clean (the full typecheck was not run).oxlintis clean andpnpm-lock.yamlis unchanged.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
selfTest.coveragealready exists. It now carries the daemon's own report, and an older daemon falls back to the same per-platform value as before.