Skip to content

Flaky test: "a mandatory call deadline overrides requestTimeoutMs: 0" races a fixed sleep against a child's 300 ms reply #478

Closed

Description

@Anarchid

What's wrong

test/mcpl-request-timeout.test.ts:164-189 (main e670363) is flaky. The test:

  1. spawns a stub server whose tools/call answers 300 ms after it receives the call;
  2. calls with a 75 ms deadline;
  3. sleeps a fixed 350 ms after the rejection;
  4. asserts that exactly one orphaned-response arrived.

That leaves about 125 ms of slack. On a loaded runner the reply lands after the sleep, so the test sees [] and fails.

Why it matters

It turns main red with no code change. CI for cabf3d0 (the merge of #412, Oct 18) failed only on macOS / Node 24, only in this test (actual: []). The next merge passed. #407 fixed the same class of problem in the guard's #281 tests.

How it was found

While checking whether main's red CI matched the red check on #372 (Actions run 39087371623).

Suggested fix

Wait for the event rather than sleeping: once(connection, 'orphaned-response'), raced against a timeout of several seconds.

Found during our review of #372: #372 (review)

Posted by the maintainer's desk assistant.

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