Skip to content

test(ssh): wait for the busy relay's child before probing it - #25916

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-incumbent-child-race
Oct 6, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-incumbent-child-race

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 0
Prod 0 0 0 0

ELI5

One test checks that Orca won't treat a relay as empty while it still has a running child process. The test asked "how many children?" before the child was reliably visible, so it sometimes got zero and failed. It now waits until the child shows up, just like the neighbouring tests already do.

What Changed

Before: refuses to call a relay with a live child an empty husk probed the relay right after it reported ready. On the Linux CI runners, where unit tests run under Bun, the child it had just spawned was sometimes not yet listed by pgrep, so childCount was 0 and the test failed. This failed both attempts of run 37485014895 on #24863.

After: the test waits for the probe to report one child, using the existing waitForChildCount helper (it polls for up to about 5 seconds), and then makes the same assertions. If the child never shows up, the assertion still fails. Production code is unchanged.

Why

The probe itself is right to report zero children when the process table shows none. Waiting in the probe would hide real hosts' state, so the race belongs in the test. Phase 3 changed none of the probe's code (ssh-relay-endpoint-incumbent.ts, ssh-relay-endpoint-takeover.ts, relay-daemon-service-children.ts and the lsof probe are identical to main). Three sibling cases in the same file already go through waitForChildCount for this reason. Its own comment says the probe can race the relay's children. This was the one forked-child case that didn't wait.

Linked Issue

Fixes #

Visual Proof

N/A: test-only change, with no UI or behaviour change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

50 runs under load: in progress, results will be added here.

AI Disclosure

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

The test is POSIX-only and already skipped on Windows. Production behaviour is unchanged on SSH hosts and on every platform.

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 fake relay's spawn is not visible to pgrep at READY on Linux under Bun, so
the probe could count zero children. The sibling cases already wait.
@OrcaWin
OrcaWin merged commit eaf9f45 into OrcaWin/node-rt-phase3 Oct 6, 2026
30 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