Skip to content

ci-fix: the corpus render sweep fails on a load event that never fires #629

Closed

Description

@leaf-agent

test_page_fixture_renders[corpus] fails often enough on main that the nightly complete suite is close to a coin toss on it alone. It failed run 34675185881 on ca9bf116, and it reproduces on d1319e88 in a plain -n0 selection:

uv run pytest --run-nightly -q -n0 -p no:randomly \
  "tests/test_render_gate.py::test_page_fixture_renders[corpus]"

Measured on one idle four-core Linux box with the installed Chrome, the rate drifts a great deal across an hour — 0 in 6 at one point, 4 in 6 at another, 2 in 7 interleaved against a branch. Any comparison between two revisions has to interleave its runs; a block of eight against another block of eight will say whatever the hour says.

What the failure is

The gate gives up thirty seconds into wait_for_load_state("load"). The document is at readyState: "interactive", the runtime has started and its banner is on the page, and the console is empty. Two endings occur, both while the corpus page is loading its layer:

  • A module request still open. /runtime/dom-children.js, /vendor/jsdiff.esm.js, /runtime/native-layers.js, /runtime/layer-client.js — a different file each time, so it is not a file's own fault.
  • Nothing in flight at all. Every request the page made has finished or failed, and the load event still never fires.

Neither scheme nor viewport is fixed: [light] and [dark], 1200x900 and 540x720.

After the change in the linked pull request the gate names this itself, so a nightly failure no longer has to be re-derived:

[dark] pre-upgrade proof failed: the document never reached load; still requesting /runtime/layer-client.js

What has been ruled out

  • The one-second read deadline on the page server's connections. It really did drop requests written onto a connection idle past it — deterministically, and it is fixed in the linked pull request — but removing it does not change the corpus rate (3 failed / 7 against 2 failed / 7, interleaved).
  • HTTP/1.0 answering each request on a connection of its own. Serving the temporary page over HTTP/1.1 instead, so the hundred-odd module requests share a handful of connections, looked like a cure at 0 failed / 8 and then failed 2 in 5 an hour later. That change is not in the pull request; it has no demonstrated benefit.
  • A regression from Fix nightly browser and site regressions #620 or Prove authenticated visual review journeys #618. The sweep fails at d1319e88 with nothing applied.

What has not been examined

start_with_pre_upgrade_proof holds **/leaf.js through a Playwright route, and the route is only removed in the finally — so page-level request interception is still on for the whole module burst that follows, and every one of those requests crosses the driver. Releasing and unrouting before the load wait is a one-line change and is the next thing to try. It would fit both endings: a request lost in interception stays open, and one whose completion the driver loses leaves nothing in flight with the load event still pending.

Activity

  1. leaf-agent commented on Sep 12, 2026

    @leaf-agent
    CollaboratorAuthor

    Reproduced and traced: the failure is the teardown of Playwright's request interception, and #631 keeps it out of the module burst. CI on that branch is green.

    page.route("**/leaf.js", hold_entry, times=1) is a single-shot handler. Playwright drops a spent handler and, when that empties the page's route list, sends setNetworkInterceptionPatterns([]) — turning Chromium's Fetch domain off. The handler is spent when held[0].continue_() resolves, which is the same instant the entry is delivered and the layer starts asking for its hundred-odd files, so interception comes down under the burst and requests caught in the transition are lost. Both endings follow from that: the swallowed request stays named in flight, and one whose completion the driver loses leaves nothing in flight with the load event still pending.

    The direct evidence that disabling interception acts on requests already paused in the browser: unrouting before releasing the entry makes Chromium continue the held route itself, and Playwright's continue_() then fails Route is already handled!, 4 attempts out of 4.

    Measured at the scheme boundary against the served corpus page, one attempt per arm in rotation on one idle four-core Linux box:

    current (times=1)                5 failed / 60
    route kept across the load wait  0 failed / 60
    unroute() after the release      1 failed / 60
    no route at all                  0 failed / 50   (against 5 / 50 for current, separate rotation)
    

    So the next step the issue names — releasing and unrouting before the load wait — is real but partial. It makes the teardown an awaited call instead of a floating task, which is why it drops from 5 to 1, but it does not move it out of the burst. Dropping times=1 does: the route list stays non-empty across the load wait, and the page.unroute already in the finally becomes the single teardown, on a document that has loaded.

    test_the_pre_upgrade_proof_holds_its_entry_route_past_the_load_event states that ordering rather than sampling the race, since the failure is ~8% per attempt and nothing deterministic distinguishes it from a slow page. #630 is unaffected — its two repairs stand on their own, and this is the remainder it handed over.

    One thing worth a maintainer's eye beyond this case: the suite already knows this hazard on its own side. arm_interception in tests/render_harness.py arms every page open_page makes on a pattern nothing ever asks for, precisely so a route registered later never toggles interception. The render gate opens its own pages and has no equivalent, so version check --render runs unarmed for a reader too. #631 removes the one toggle that was landing inside a load; whether the gate's pages should be armed the way the suite's are is a wider call.

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