Skip to content

Flaky test: submit.contract.test.ts refuses the first message on a busy CI runner #450

Closed

Description

@devswha

What happens

server/submit.contract.test.ts, "types nothing of a message that waited past its deadline behind another", fails now and then in the "Integration and browser" job, on PRs that do not touch server/:

error: expect(received).toMatchObject(expected)
-   "ok": true,
+   "code": "submit_timeout",
+   "id": 1,
+   "message": "the message waited too long behind earlier input; nothing was typed",
      at server/submit.contract.test.ts:280

Seen three times in two days, each time gone on a rerun or on the next run:

Why

The test starts a server with submitDeadlineMs: 50 and sends two messages. The second is meant to pass the deadline while it waits behind the first one's gap (SUBMIT_DELAY_MS, 120 ms). The deadline is measured from the moment a message reaches the server to the start of its turn (server/index.ts, Date.now() - arrivedAt > submitDeadlineMs), so the first message has the same 50 ms to get its turn. On a runner that is busy (the integration files run four at a time beside the browser lane) that is not always enough, and message 1 is the one refused.

A fix

Make the two sides of the comparison far apart instead of 50 ms against 120 ms. For example a createServer option for the gap, used only by this test: a gap of about a second and a deadline of a few hundred ms. The first message then has hundreds of ms to start, and the second still waits well past the deadline.

Also seen once each on the same day

In the same job, on #439, which changes none of these:

  • server/updater.test.ts:327, "hands over to the installed release's own supervisor" (expected 0, received 1)
  • server/api.contract.test.ts, "rejects input from a non-attached client and signals readiness to the owner"
  • scripts/chat-size-regression.ts:163, "the picked pane attaches in its own lens" (keep_size undefined on the attach frame)

Activity

  1. added a commit that references this issue on Oct 5, 2026
    65fdd38
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