Skip to content

bug(tests): unref'd AbortSignal.timeout fixtures cancel all local inprocess-reviewer and rdd-status-line tests on Node 22 #1436

Description

@danielgap

Before submitting

  • I searched open and closed issues and did not find a report of this problem.
  • I reviewed this report and removed credentials, tokens, private paths, hostnames, and other sensitive data.

Problem

Local pnpm test exits 1 with 36 cancelled tests and zero failed assertions: 26 in tests/inprocess-reviewer.test.ts and 10 in tests/rdd-status-line.test.ts. Both suites contain fixtures that await never-settling fakes raced against AbortSignal.timeout(). That API's timer is unreferenced, so once the microtask queue drains, Node exits the event loop while the test promise is still pending. The runner reports "Promise resolution is still pending but the event loop has already resolved", cancels that test, and then cancels every later test in the same file as a cascade. The first cancellations are the timeout test at tests/inprocess-reviewer.test.ts:274 and the never-settling reader test at tests/rdd-status-line.test.ts:169.

This is a fixture-liveness defect, not a production timeout problem: neither production path is asserted to misbehave. The smallest fix keeps a bounded referenced handle alive only while each never-settling fixture awaits its timeout, clearing it afterwards; an alternative is a Node-version-gated keepalive in scripts/run-test-suite.mjs.

Related but distinct from #1157, which describes the wall-clock deadline assertion cancelling rdd-status-line tests under load: these cancellations fire before any assertion runs, and inprocess-reviewer currently has no tracker for this class.

Steps to reproduce

On Node 22 (reproduced on v22.22.2), from a source checkout of current main:

  1. node --experimental-strip-types --test tests/inprocess-reviewer.test.ts produces 10 pass / 0 fail / 26 cancelled.
  2. node --experimental-strip-types --test tests/rdd-status-line.test.ts produces 8 pass / 0 fail / 10 cancelled.
  3. Full pnpm test on main produced 3398 pass / 36 cancelled / 41 skipped / 0 failed assertions, with all 36 cancellations in the two files above.

CI is green on the same commits because .github/workflows/ci.yml pins Node 24, whose event loop keeps these timer-resolved promises alive.

Expected and actual behavior

Expected: the local suites complete (or fail with real assertion failures) on a supported Node version.

Actual: the runner cancels the first never-settling fixture test in each file with "Promise resolution is still pending but the event loop has already resolved", and every subsequent test in that file is cancelled as a cascade, making the full local suite permanently red on Node 22.

gentle-pi version

Source checkout of main at 80375c6 (package version 3.7.0); also reproduced at 758d2bb.

Pi version

0.87.1

Operating system

Linux

Relevant logs or error output (optional)

not ok 11 - inprocess reviewer refuses with TIMED_OUT when the completion exceeds its bound
  ---
  duration_ms: ~
  cancelledByParent: true
  error: "Promise resolution is still pending but the event loop has already resolved."
  ...

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions