Skip to content

Run the local site verification with container prewarm off - #1027

Merged
max-sixty merged 1 commit into
mainfrom
fix/ci-35899003033
Sep 23, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/ci-35899003033

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

scripts/verify-site-local.sh now starts the local Worker with AGENT_PREWARM set to false, so nothing starts a reader's container while the browser is fetching the modules of the page the pass is measuring. That overlap is what has been reddening this gate: four runs in two days have stopped on a page that never presented, with net::ERR_NETWORK_CHANGED on its module loads — three in publish-site and one in ci's test, most recently run 35899003033 on main. Fixes #981.

Why a container start breaks the load beside it

Chromium answers a host IP-address change by flushing its socket pools, handing every request in flight ERR_NETWORK_CHANGED, loopback included. Starting a container under Docker's bridge networking adds a host interface, which is that change. I found no way to opt out: the shipped Chrome binary carries no network-change command-line switch, only NetworkChangeNotifierLinux itself. And only this pass puts the two on one host — a reader's container runs on Cloudflare, so no production page load starts one on the machine drawing the page.

The Worker starts that container from the document response itself. With AGENT_PREWARM true, a GET carrying Sec-Fetch-Dest: document hands prewarmContainer to ctx.waitUntil (worker/src/index.ts#L907-L922), so every page the verifier opened for the first time was measured while Docker wired up that page's container. Both logs in #981 and the run above show it: container_prewarm_started for the page, its document and bundle GETs, and a startup report of outcome: 'timeout', reason: 'entry module did not load' while the Worker answered every asset 200.

With prewarm off, the only thing that starts a container locally is the activation read (api/view) that verify_site.py makes and waits on for each page in turn. That request is not a browser load and nothing is loading beside it, so the host's interfaces are settled for every load the browser is measured on.

What the gate gives up

Nothing it asserted. Prewarm is deliberately outside the reader's startup path — ctx.waitUntil, after the Server-Timing header is stamped — so it never appeared in the startup profile this pass reports, and no check read it. A prewarm failure is caught and logged rather than surfaced, so none could have failed the gate either. worker/test/index.test.ts still covers the dispatch, the rate-limit denial and the non-navigation probe; worker/wrangler.toml still declares "true", so production and the dev environment are untouched and publish-site's post-deploy pass over the public release exercises prewarm against real Cloudflare containers. worker/README.md already documents false as a supported setting for comparing cold startup without changing the request path. The cost is that the activation read now absorbs the cold start it used to find done — a second or two inside a 45-minute job.

Verification, and what is left

The gate ran on this branch and passed: test's Measure the bundled release in Chrome step verified all three pages and the /how-it-works/ neighbour, and the requests and bytes at presentation are identical to the failed run's — / reports 15 JS / 300 KiB, 17 code / 463 KiB, 25 total / 628 KiB on both — which is the comparison AGENTS.md asks for on a change that can alter startup. The elapsed figures move with the runner, as that rule says. One green run would not on its own separate the fix from luck, since the flush has to land inside a module load to matter; what the change rests on is that the start it needs no longer happens while a measured load is in flight.

The race itself is not reproducible from the bot sandbox, which has no usable Docker. What I could check directly is the override: wrangler dev --var AGENT_PREWARM:false, under the pinned wrangler 4.131.1, beats the "true" in wrangler.toml and the Worker reads "false" — run against a throwaway Worker that returns env.AGENT_PREWARM, and confirmed against that wrangler's own --var parsing, which splits on the first :. shellcheck and the rest of pre-commit pass on the script.

One exposure this does not remove. Docker drops a host interface when a container stops, which triggers the same flush, and a page load overlapping a teardown would fail the same way. Every occurrence so far is a start overlapping a load, and removing the start is what can be done from inside the workflow; isolating Chrome in its own network namespace would cover both directions but needs privileges the job does not have.

The failing page's 30 registry.json fetches, which #981 left open as possibly a separate defect

They are the failed page's own recovery loop, not a defect of a healthy load. In the same Worker log, the two pages that presented fetched their revision's registry.json once each (root and examples--triage-board); how-it-works, the page that timed out, fetched it 30 times. bootstrap.js polls the probe — which is that registry.json — once a second while the page has not presented, looking for a release or layer that could start it (bootstrap.js#L163-L206). The verifier waits 30 s for presentation, so the count is the wait. It also confirms the page never started rather than presenting late.

Chrome and Docker share one host only in this pass. Starting a reader's container adds a host interface, Chromium flushes its sockets on that change with ERR_NETWORK_CHANGED, and prewarm puts the start inside the module loads the pass measures. Without it the only container start is the activation read the verifier waits on.
@max-sixty
max-sixty merged commit 50e7974 into main Sep 23, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/ci-35899003033 branch September 23, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci-fix: publish-site failing — Chrome ERR_NETWORK_CHANGED while the local page container starts

2 participants