Skip to content

fix(orcad): a launch reads readiness at least once; fake hosts match the capture's tar flag, not any -cf - #25918

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-rollback-launch-flake
Oct 6, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-rollback-launch-flake

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

ELI5

One orcad crash-recovery test failed now and then in CI: a rollback "never started orcad". It had two causes, and both are fixed here. One was in the test's fake host. The other was a small real timing gap in how the client waits for a launched server to be ready.

What Changed

  • Fake host misread commands (test-only). Every fenced remote command carries a random fence token, which is a UUID. About 1 token in 125 contains the text -cf. The fake hosts used in the orcad tests treated any command containing -cf as a snapshot capture. So when a token happened to contain it, the rollback's restore step was answered as a capture (CAPTURED). The rollback then reported "the pre-activation snapshot could not be restored" and never launched. That is exactly the CI failure.
    • Before: the fake hosts matched a bare substring.
    • After: they match the capture's real tar -C <dir> -cf form, through one shared helper (orcad-snapshot-capture-command.ts) used by all four fakes.
    • A new test pins a token containing -cf and proves the rollback still restores and launches. It fails on the old fake and passes on the new one.
  • Readiness check could be skipped entirely (production). launchOrcadAndAwaitReadiness set its deadline and then looped while (Date.now() < deadline). If the client process was descheduled between those two lines for longer than the timeout, it never read readiness once. A ready launch was then reported as not ready.
    • Before: zero readiness reads were possible.
    • After: the launch always reads readiness at least once, then honours the deadline as before.
    • Under heavy CPU load, the tests' 50 ms timeout hit this gap: 4 of 50 parallel runs failed after the first fix alone. A new test with a 0 ms timeout fails before this change and passes after it.

Why

The CI failure was nondeterministic, so it needed a cause, not retries. A sweep of 9,000 random fence tokens across the update, first-activation and rollback scenarios found no other token-dependent misreads once the capture match was fixed. The at-least-once read is the smallest change that removes the scheduling gap without changing any timeout. On a real host a zero-second read is already supported, because the wait command clamps it to a single check.

Linked Issue

Fixes # (maintainer: flaky phase3 landing check, no issue)

Visual Proof

N/A: no UI change; this affects the remote launch readiness loop and test fakes.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Ran the crash-recovery, rollback, deploy, state-mutation-timeout, managed-wake and decommission test files 50 times: 5 runs in parallel at a time, alongside 8 CPU-saturating processes. All 50 were green (91 tests each). With only the fake-host fix, 4 of 50 failed.

  • src/main/ssh: 4011 passed.

  • pnpm tc:node: clean.

  • Changed-code quality gate: passed.

  • Ran on macOS. The readiness loop is shared by POSIX and Windows hosts, and the fix applies to both.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

SSH: the readiness change only adds one guaranteed read. It sends no new commands and no wire change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…the capture's tar flag, not any -cf

A random fence token contains `-cf` about 1 time in 125, and the fake hosts
read any command containing it as a snapshot capture, so a rollback's restore
answered CAPTURED and the rollback never launched. Separately, a client
descheduled between computing the readiness deadline and checking it skipped
every read and failed a ready launch.
@OrcaWin
OrcaWin merged commit 64bcdd2 into OrcaWin/node-rt-phase3 Oct 6, 2026
62 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant