Repository navigation
Report the stalled page and its startup milestones when the site gate times out - #467
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
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.
`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.
cionmainwent red at c8119589 whenMeasure the bundled release in Chrometimed out waiting forbody[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, andverify-site-local.shprints the Worker's log only when the server never answerscurlat 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_SCRIPTalready records each startup stamp as it lands, so the stamps standing at the timeout separate the two waysstartPagecan stall: a widget upgrade that never settled leaves no stamp, while a first state read that never answered leavesupgradedstanding 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:
readStatetreats a failed fetch as a complete offline answer and presents on it, but thefetchcarries 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 --filesover the four changed files; andscripts/verify-site.pydriven against a localwrangler devover 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
mainat 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 underskills/leaf/assets/is one banner sentence.wrangler devalso awaits container-image preparation before it starts the local server, so the heavier website image#460introduces cannot be competing with the browser oncecurlhas answered.