Skip to content

[rush-daemon] Fix three daemon/client tests that flake on slow agents - #6238

Open
Sean Larkin (TheLarkInn) wants to merge 1 commit into
mainfrom
user/selarkin/bot-fix-publish-daemon-flakes
Open

Sean Larkin (TheLarkInn) wants to merge 1 commit into
mainfrom
user/selarkin/bot-fix-publish-daemon-flakes

Conversation

@TheLarkInn

Copy link
Copy Markdown
Member

Summary

Three daemon/client tests flake on slow agents. They fail the "Rush retest" step of the Rush publish pipelines (RushStack ADO defs 10 and 12). Since the pool fix in #6220, 5 of 11 runs failed there. This PR makes the tests deterministic. It does not skip or remove any check.

Details

rush-client-core: "waits a whole backoff step between attempts once its startup helper has exited" (builds 12944, 12957)

The client's backoff keeps doubling while the helper runs. By the time the helper exits, each step is 500 ms. The test gave the whole startup 3 s. On a slow agent the helper exited late, so only one attempt fit after the exit: Expected: > 1, Received: 1.

Fix: the deadline is now 8 s. The fixed < 10 upper bound becomes a bound computed from the backoff schedule (50, 100, 200, 400, then 500 ms) and the time actually left after the exit. A client that spins still fails it.

rush-cli-client: "preserves graph admission and cancellation across expired-preflight" (builds 12947, 12958)

The client ran with --wait-timeout 0.1, and that budget includes connect and hello. On a slow agent it ran out before the client sent the preflight. The client then never sent a request, and requests[0].argv threw.

Fix: the budget is now 2 s. The fake daemon holds the preflight reply until that budget has passed: the request's own waitTimeoutMs plus 100 ms. So the deadline always expires during the preflight, as the test intends. The test still asserts exactly one request, exit 1, "deadline expired", and a budget at or under the requested value.

rush-daemon: "attests the actual bundled engine and protocol..." (build 12945)

Attestation spawns a Node.js probe that loads rush-lib. The test used Jest's 5 s default and timed out. It now has 15 s, as the other probe-spawning tests in this file do. Its twin, "honors an explicit native preview selection", spawns the same probe and gets the same 15 s.

How it was tested

Each test was looped on Node 24.22.1, the publish pool's version, with HTTPS_PROXY set, pinned with taskset to the CPUs shown, alongside 3 busy-loop processes:

Test CPUs Before After
rush-client-core backoff step 2 1/10 failed 0/20 failed
rush-client-core backoff step 1 20/20 failed 0/20 failed
rush-cli-client expired-preflight 1 3/20 failed 0/20 failed
rush-daemon attestation 1 1/20 failed 0/20 failed

All three projects' full test suites pass.

Other daemon flakes seen in GitHub CI are already covered by #6233 and #6153, so this PR leaves them alone.

The Rush publish pipeline's "rush retest" step failed on these tests on
slow agents:

- rush-client-core "waits a whole backoff step...": a 3 s deadline left
  no room after a late helper exit. The deadline is now 8 s, and the upper
  bound is derived from the backoff schedule and the time that remained.
- rush-cli-client "expired-preflight": a 100 ms budget could expire during
  connect, before the preflight was sent. The budget is now 2 s, and the fake
  daemon holds the preflight reply until that budget has passed.
- rush-daemon launcher attestation tests: they spawn a Node.js probe but
  used Jest's 5 s default timeout. They now get 15 s, like their peers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08766d06-fe09-43d1-b604-3b9f433d1785

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant