You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep the Node 22 plugin tests alive while they await unref'd timers - #3437
Node 22 can end a whole-directory run of runtime/flybot-workspace-web with cancelled > 0 and exit code 1 while no assertion failed, because two timers the
tests await are unref'd: the runtime() rejection timer (src/host.js:28) and
the memory capture scan scheduler (features/memory/capture.js:198). Both are
correct in production — a server always has a listening socket — so the tests are
what has to change.
This slice keeps the test's event loop alive while it awaits, and changes nothing
else.
test/features.test.js: the runtime() timeout test wraps its assert.rejects
in a 1 s keep-alive timer, cleared in finally.
test/memory-extras.test.js: the group-capture test wraps its Promise.race([extracting, delay(6000, null, {ref: false})]) in a 6 s
keep-alive timer, cleared in finally.
src/host.js and features/memory/capture.js are untouched. Removing the unref calls would instead change production behaviour: the runtime() timer
would hold the event loop open for up to the default timeoutMs = 15_000.
Evidence (local, not CI)
Measured on the content of main at 1a981717f2b708f796b820ec871058ab339b8fa2 (tree b43a727d), rebuilt from
codeload and verified byte-identical (git add -Af then write-tree = b43a727d). A/B on two copies that differ only in these two files, same shell,
same TMPDIR, Node v22.23.5, --test-concurrency=2.
This branch is cut from main at e6aeae4e (tree 93a2fb2d), after #3435. #3435 edited test/features.test.js only inside three other tests (it threads TEST_ENV there); the two tests this slice changes - the runtime() timeout
test and the group-capture race - are unchanged, and test/memory-extras.test.js
is untouched by #3435.
The whole-directory line is the strict A/B: exactly four results move from
cancelled to pass (#176 #177 #233 #234), the fail count does not change, and
exactly four results move. QA Engineer reproduced the same four-result delta on a
second host (their absolute counts differ: 482 / 11 / 4 to 486 / 11 / 0),
which is expected — see below.
Absolute whole-directory counts on this content are host-dependent, because the
suite still inherits host environment variables (Refs #3434); that is why the
table compares per-file counts and the delta rather than claiming a green
directory.
Node v24.22.3, same two copies: 497 / 486 pass / 11 fail / 0 cancelled in
both, so the keep-alives are a no-op on the version CI uses. The 11 failures are
the host-environment family from #3434, identical before and after.
Non-goals
No Node 22 job is added to CI, and no current CI conclusion is affected: the
only job that runs this directory is flybot-runtime-image.yml on Node 24.
Does not touch the second cancellation cluster in test/social-templates.test.js
(#442-#447), whose cause is a feature that fails to load, not an unref'd
timer.
Does not claim the directory is green, and does not change any assertion.
Head fd392ab5b756b597d1110fb03567c93d3524cb7a (refs/pull/3437/head), base main e6aeae4e2bae52d13e721506a41e598a222655ea, one commit Keep the Node 22 plugin tests alive while they await unref'd timers, 2 files +15/-2, tree dffcaed5782aedb4f710695d9d06af9bd5d2e93e.
Slice
Two test-side keep-alive timers, one per cancelled site:
test/features.test.js: the runtime() timeout test keeps the loop alive around assert.rejects(...).
test/memory-extras.test.js: the group-capture test keeps the loop alive around its Promise.race.
Both are finally-cleared. No assertion, no timeout value, and no production file changes. src/host.js:28 and features/memory/capture.js:198 stay as they are: removing their unref
would change production behaviour, because the runtime() timer would then hold the loop for up
to the default timeoutMs = 15_000. That is why the fix is on the test side.
Local evidence (measured by me, not CI)
Node v22.23.5, --test-concurrency=2, two clean trees from codeload (base e6aeae4e, head fd392ab5); diff -rq between them reports exactly these two files.
Whole-directory absolute counts are host-dependent: the suite still inherits host environment
(Refs #3434). On this host the base fail count is 0; on the author's host both columns carry 17
fails and the same four-result delta. The delta is the evidence; the absolute numbers are not.
Independent runs on the same content
Runtime Dev (author): same four-result delta - 1 cancelled -> 1 pass, 9 pass / 2 cancelled -> 11/11, whole directory 470 -> 474 pass with the fail count unchanged.
QA Engineer reproduced the same per-file deltas on the two blobs before this branch existed, and
reconstructed this head from them with git hash-object.
QA's re-run against this exact head is outstanding. The local table above is my own run; it is
the only exact-head local evidence in this record.
CI (this head only)
check-runs for fd392ab5: total 18 == returned 18, 18/18 completed + success, no
in_progress, failure, cancelled or neutral, and all 18 head_sha equal this head.
One reading note: the only job that runs this directory is flybot-runtime-image.yml -> Image recipe contract tests on Node 24, where both keep-alives are a no-op. Its green says "no
Node 24 regression", not "the Node 22 fix works". The fix evidence is the Node 22 table.
Out of scope / residuals
The second cancellation cluster in test/social-templates.test.js (#442-#447, cancelledByParent from a feature that fails to load) has a different cause and stays in the
issue.
No Node 22 CI job is added; Node 22 coverage remains a local practice.
This is not a parity claim and not an acceptance sign-off. It records one slice on one head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
risk:T1Risk tier T1 (client, tests, generated files), set by the controller from the diff
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Node 22 can end a whole-directory run of
runtime/flybot-workspace-webwithcancelled > 0and exit code 1 while no assertion failed, because two timers thetests await are
unref'd: theruntime()rejection timer (src/host.js:28) andthe memory capture scan scheduler (
features/memory/capture.js:198). Both arecorrect in production — a server always has a listening socket — so the tests are
what has to change.
This slice keeps the test's event loop alive while it awaits, and changes nothing
else.
Related #3436. Refs #3434.
Change
test/features.test.js: theruntime()timeout test wraps itsassert.rejectsin a 1 s keep-alive timer, cleared in
finally.test/memory-extras.test.js: the group-capture test wraps itsPromise.race([extracting, delay(6000, null, {ref: false})])in a 6 skeep-alive timer, cleared in
finally.src/host.jsandfeatures/memory/capture.jsare untouched. Removing theunrefcalls would instead change production behaviour: theruntime()timerwould hold the event loop open for up to the default
timeoutMs = 15_000.Evidence (local, not CI)
Measured on the content of
mainat1a981717f2b708f796b820ec871058ab339b8fa2(treeb43a727d), rebuilt fromcodeload and verified byte-identical (
git add -Afthenwrite-tree=b43a727d). A/B on two copies that differ only in these two files, same shell,same
TMPDIR, Nodev22.23.5,--test-concurrency=2.This branch is cut from
mainate6aeae4e(tree93a2fb2d), after #3435.#3435 edited
test/features.test.jsonly inside three other tests (it threadsTEST_ENVthere); the two tests this slice changes - theruntime()timeouttest and the group-capture race - are unchanged, and
test/memory-extras.test.jsis untouched by #3435.
maincontentnode --test --test-name-pattern='runtime\(\) resolves' test/features.test.js1 test / 1 cancelled, exit 11 / 1 pass, exit 0node --test test/features.test.js6 / 4 pass / 2 cancelled, exit 16 / 6 pass, exit 0node --test test/memory-extras.test.js11 / 9 pass / 2 cancelled, exit 111 / 11 pass, exit 0node --test --test-concurrency=2 test/*.test.js497 / 470 pass / 17 fail / 10 cancelled, exit 1497 / 474 pass / 17 fail / 6 cancelled, exit 1The whole-directory line is the strict A/B: exactly four results move from
cancelled to pass (
#176 #177 #233 #234), the fail count does not change, andexactly four results move. QA Engineer reproduced the same four-result delta on a
second host (their absolute counts differ:
482 / 11 / 4to486 / 11 / 0),which is expected — see below.
Absolute whole-directory counts on this content are host-dependent, because the
suite still inherits host environment variables (Refs #3434); that is why the
table compares per-file counts and the delta rather than claiming a green
directory.
Node
v24.22.3, same two copies:497 / 486 pass / 11 fail / 0 cancelledinboth, so the keep-alives are a no-op on the version CI uses. The 11 failures are
the host-environment family from #3434, identical before and after.
Non-goals
only job that runs this directory is
flybot-runtime-image.ymlon Node 24.test/social-templates.test.js(
#442-#447), whose cause is a feature that fails to load, not anunref'dtimer.