Skip to content

Report the stalled page and its startup milestones when the site gate times out - #467

Merged
max-sixty merged 2 commits into
mainfrom
fix/ci-34296622586
Sep 9, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/ci-34296622586

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

ci on main went red at c8119589 when Measure the bundled release in Chrome timed out waiting for body[data-lf-presented] (run 34296622586). Rerunning that same job at that same commit passed, and printed the ordinary profile — presentation at 1212 ms on /, 1033 ms on /examples/design-decision/, 2151 ms on the frozen gallery revision. So the merge did not break the served site: one page stalled once, 25× past its usual cost, and then the evidence was gone.

It was gone because the gate keeps none. The failure the run recorded is Playwright's own Locator.wait_for: Timeout 30000ms exceeded, which names neither the page that stalled nor how far its startup got, and verify-site-local.sh prints the Worker's log only when the server never answers curl at all — a browser-side failure discards it. Reproducing was the only route left, and 36 loads of the same three pages against the same built release did not reproduce it.

This makes the next occurrence answer the question this one could not. PROFILE_SCRIPT already records each startup stamp as it lands, so the stamps standing at the timeout separate the two ways startPage can stall: a widget upgrade that never settled leaves no stamp, while a first state read that never answered leaves upgraded standing alone. The wait now raises that reading with the page's URL and any browser errors already collected, and the shell prints the Worker's log beside it, since a stalled request is a fact about both halves.

The distinction is worth having because the two have different fixes. A first state read that never answers is a reachable end state today: readState treats a failed fetch as a complete offline answer and presents on it, but the fetch carries no deadline, so a response that neither arrives nor errors leaves the page unpresented with no retry behind it — for a reader on a stalled connection as much as for this gate. Whether that read should have a deadline, and what it should be, is a product decision this change deliberately does not make.

Verification

uv run pytest tests (934 passed, 6 skipped); uv run pre-commit run --files over the four changed files; and scripts/verify-site.py driven against a local wrangler dev over the built release, where all three pages presented and the run proceeded to the container-activation checks. The new unit test covers the message this change exists to produce; the timeout branch that builds it was exercised directly against a stub page.

Why the merge is not the cause

#460 passed the same step on its own head in 24 s, and main at be6be02c passed it too; the squash merge of the two is the first commit where this step has ever failed, which is what made a regression the obvious first reading. Against it: the same commit's rerun is green, the presentation costs and byte counts in that rerun match the pre-merge run to within noise, and nothing in #460's runtime surface reaches presentation — its only change under skills/leaf/assets/ is one banner sentence. wrangler dev also awaits container-image preparation before it starts the local server, so the heavier website image #460 introduces cannot be competing with the browser once curl has answered.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The milestone reading this change exists to produce is installed only on the pages verify_page opens. verify_cross_tab_activation creates its leader and follower without page.add_init_script(PROFILE_SCRIPT), so a stall in that step evaluates window.__leafStartup as undefined and reports no startup milestone — which unpresented's own docstring assigns to an upgrade that never settled. That sends the next reader to the wrong one of the two fixes, on the only step where the reading has no source at all. Inline suggestion installs the profiler on those two pages, matching verify_page's order of new_page → add_init_script → goto.

Otherwise the change reads as described: the upgraded-alone reading does separate the two stall classes (startPage stamps data-lf-upgraded before handing the first read to startFeed), and the deferred product question is real — readState's fetch carries no deadline and its catch returns a completed offline answer, so a response that neither arrives nor errors leaves presentation waiting with no retry behind it.

Comment thread scripts/verify-site.py Resolved
`verify_cross_tab_activation` built its leader and follower without
`PROFILE_SCRIPT`, so `await_presentation`'s new reading would report `no
startup milestone` for either stall class on that step — the reading
`unpresented` assigns to an upgrade that never settled. Install the profiler
in the same `new_page` → `add_init_script` → `goto` order `verify_page` uses.
@max-sixty
max-sixty merged commit 474241f into main Sep 9, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/ci-34296622586 branch September 9, 2026 02:34
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.

2 participants