Skip to content

Flaky: the workers page Events tab test closes the page before a response is read #1005

Closed

Description

@V3RON

What happened

e2e/console/workers.spec.ts:785 "the workers page › on a gateway the Events tab lists only that worker's events, on a single host all of them, and scrolls back through that worker's history, shows its new events at the top, and with none says No events for this worker yet." fails in the Console (4/4) job, its retry too:

Error: response.json: Target page, context or browser has been closed
> 828 |         void response.json().then((body: { events?: (typeof answered)[number][] }) => {

What you expected

The test passes on every run of an unchanged commit.

How to reproduce

Seen twice on two commits that leave the console alone: CI run 40184982178 on main at def25c8, and attempt 1 of run 40193478934 on PR #1003. A re-run of the failed jobs passed.

Environment

GitHub Actions, Console (4/4) shard, chromium.

Logs and evidence

gh run view 40184982178 --log-failed; gh run view 40193478934 --attempt 1 --log-failed.

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8), and nothing more.
    flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.
    on Oct 25, 2026
  2. self-assigned this
    on Oct 25, 2026
  3. V3RON commented on Oct 25, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Defect in the test, not the console: every assertion passes, then an unread body rejects as the page closes. Correction: the console lane has no retries (playwright.config.ts); "its retry too" was the second run.

    e2e/console/workers-events-read-outlives-page.spec.ts on bug/1005-repro, "a /v1/events body still unread when host.dispose() closes the page is dropped by the Events tab test's reader instead of escaping it". It holds the older-page read until host.dispose() has closed the page. Fails 6 of 6:

    pnpm test:console --project=chromium e2e/console/workers-events-read-outlives-page.spec.ts
    
    Error: the reader must read or quietly drop a /v1/events body the page closed under, not let the rejection escape it
    +   "Error: response.json: Target page, context or browser has been closed",
    

    The lane test failed 2 of 104 runs here under load. The read still open at its end was always the host's before=…&limit=100.

    Root cause

    e2e/console/workers.spec.ts:828 reads every /v1/events body with void response.json(), which is never awaited and has no catch, and the listener stays on to the end of the test. The single host's Events tab, the last page, asks for its first older page as it opens. The last assertion (:895) does not wait for that read. host.dispose() (:897) closes the page first (e2e/console/fixtures.ts:325, closeActivePages). If the body is still unread at that moment, the read rejects and Playwright fails the test.

    Simplest fix

    Keep the read promises in an array, await Promise.all(reads) before the answered assertions, then page.off("response", …) so the host part starts no reads. Apply the same reader change to the reproduction, or delete it once the fix lands.

    Alternatives rejected

    • .catch(() => undefined) on the read: the listener still reads pages the claim does not cover.
    • host.dispose({ preservePages: [page] }): the page fixture closes the page later anyway.

    Risk

    • answered must still hold more than 100 events after the change. A read that never settles would hang the test instead of failing it.

    Written by an agent.

  4. removed their assignment
    on Oct 25, 2026
  5. added
    bug:readyAn agent may fix it.
    and removed
    bug:newReported. An agent may triage it (rule 8), and nothing more.
    on Oct 25, 2026
  6. self-assigned this
    on Oct 25, 2026
  7. V3RON commented on Oct 25, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1008 (#1005)

    Written by an agent.

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

Metadata

Metadata

Assignees

Labels

bug:readyAn agent may fix it.flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions