Skip to content

Read page code on the render check's first page, and watch for layout shifts while the other pages load - #6114

Merged
max-sixty merged 5 commits into
mainfrom
render-reading-cuts
Nov 16, 2026
Merged

max-sixty merged 5 commits into
mainfrom
render-reading-cuts

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A render reading (page check --render, and each page server's background reading of what an agent hands over) now takes 22–34% less wall time on four real pages: 3.3–4.1 s off readings of 12–17 s, with the same findings. On 20 examples the median saving was 2.4 s and 1.4 CPU-s.

Two cuts make it:

  • Page code is read on the render check's first page, instead of in a fifth page load of its own that duplicated it. A page whose code can't start still ends the check on that first page, with the same findings the separate run gave.
  • The fixed 3 s watch for layout shifts a page's own timers make (page check doesn't catch a page script that resizes a block after load #4704) runs while the dark desktop and phone pages load, and then waits only for what is left of its 3 s. It can't overlap the resize sweep, because Chrome counts every shift after a resize as caused by input.

What to weigh:

  • With --render, page code now runs at the window the render check reads, the user's where one reported in the last day, rather than at 1280×720. A module that throws on startup only at other widths can pass --render while plain page check fails it.
  • Findings come in a different order: the dark and phone findings now come first.
  • While the watch runs, two renderer processes are alive at once.
  • Two failures of Leaf's own runtime, which no page author can fix, read differently from before:
    • If the runtime hangs without declaring a refusal, on a page with page code, the first page reports no-runtime after 120 s and the check goes on to the other three pages. The old run stopped after its single 240 s deadline.
    • If a shared runtime module fails to load, the check's own probes can't load either. The check reports probe-failed on each of the four pages, where the old run reported not-ready (refused) and the failed request (found by Codex's re-review; left).

The 3 s watch keeps its length. No event marks the end of a page's own timers, because the runtime keeps 2 s and 10 s timers pending on every page. In 73 real readings over 10–15 Nov it caught nothing.

Max asked for this ("research #23") in a review of timers that race a slow machine. Codex reviewed it and found that a page whose widget module failed to import lost its page-code findings and waited out four 240 s deadlines. The last commit fixes that, with a test that fails on the commit before.

Tests: 26 focused render-gate tests (one expected xfail), including the #4704 timer tests, a new page check --render arm on the page-code journey test, and the refusal case; paired benchmark runs against main on real page copies.

This was written by Claude Code on behalf of max-sixty

…its own

`page check --render` loaded the page five times: once for the page-code
run and four times for the render check's color schemes and viewports. The
page-code reading (`page_code.PageCode`) now installs itself on the render
check's first page, the desktop window in the light scheme, and gives its
verdict once that page is ready. A page whose code fails is read no further,
as before. Plain `page check` and message checks keep the run's own page at
1280x720.

The render check's readiness wait now passes `fixed_server`, as the page-code
run's did: the check reads a preview nothing replaces, so a page that declares
it cannot start is reported at once rather than at the 240 s deadline.
The render check watched the settled desktop page for layout shifts for 3 s
with nothing else running, which cost every reading 3 s of wall time. The
watch now runs while the check loads and reads the dark desktop page and the
two phone pages, and waits only for whatever of the 3 s those leave. Nothing
acts on the watched page meanwhile, so it sees the same movement: the
1.5-second timer page from #4704 is reported as before. Its sweep still runs
after the watch, since Chrome counts a resize as input and reports no shift
for 500 ms after one.

The watch is a context manager now, and its finding names how long it
watched, at least 3000 ms.
The page-code journey test now also runs `page check --render` on the page
whose widgets throw: it reports the same page-code findings as plain
`page check`, and runs no render check after them. The plain-pages journey
reads a page the way `page check --render` now does, with the render check's
first page taking the page-code reading.
…tart

With page code read on the render check's first page, a page whose widget
module failed to import never upgraded, so that page waited out its 240 s
upgrade deadline and reported only `never-upgraded`, and the check went on
to read three more pages the same way. The page-code run it replaced
refused such a page at once, because its readiness wait passes
`fixed_server`.

The render check's waits for the runtime to start and for the upgrade now
end as soon as the page declares it cannot start, as `wait_until_ready`
does for a server nothing replaces: `wait_for_probe` takes `fixed_server`
too, and the upgrade wait is `wait_until_ready` through `upgraded`. Where
the first page takes the page-code reading, a page that never gets that far
fails the reading with the same findings the separate run gave (the
runtime's reports, `not-ready` with stage `refused`, and the failed
requests), and the check reads no further. Without page code, the check
still reports `no-runtime` or `never-upgraded`, now at once for a declared
refusal.

The request-failures journey test now also reads its refusing page through
`render_version` with the page-code reading, and asserts the same findings
from one page. It failed on the previous commit: no page-code findings,
after four shortened deadlines.

Behavior change kept from the fold: with `--render`, page code runs at the
desktop window the render check reads (the user's window where one has
reported in the last day) rather than at 1280x720. A module that throws
during init only at some widths can pass `--render` at the user's window
while plain `page check` fails it.
@max-sixty
max-sixty merged commit be54f6d into main Nov 16, 2026
5 checks passed
@max-sixty
max-sixty deleted the render-reading-cuts branch November 16, 2026 06:45
max-sixty added a commit that referenced this pull request Nov 16, 2026
… the 3 s shift watch (#6136)

A render reading is now one fresh page load, light at the desktop
viewport, plus the existing width sweep from 360 to 1920 px. It no
longer loads the page again in the dark scheme and at a 540×720 phone
window, and it no longer watches the presented page for 3 s of layout
shifts. Neither part has caught anything on a real page. On this
machine:
- the 3 s watch (`passive-layout-shift`) fired 0 times, across 86 kept
readings and 373 page logs (10–15 Nov);
- of 102 distinct findings, none appeared only in dark or only at the
phone size: the light desktop load and its sweep found every one;
- a search of about 5,900 commits found no dark-only or phone-only
finding from the render check that ever led to a fix. The real
dark-theme defects in history were caught by stills or dedicated tests,
which stay.

Measured with paired runs on 8 pages (4 real page copies, 4 examples),
in shuffled order: a reading falls from about 8.3 s to about 5 s (−37%
wall, −47% CPU). The finding sets (code, element, widths) are identical
on all 13 pages tried.

Two commits:
- **Remove the 3 s passive watch.** −158 production lines, with
`shifts.js` gone. On its own it saves only 0.6 s, since #6114 already
ran the watch alongside the other loads. Combined with #6127, the render
check reads no layout shifts.
- **One light desktop load.** The scheme loop, the phone render and its
short-window sweep, and per-scheme bookkeeping go. Findings lose
`scheme` and `viewports`, which nothing else read; the suite's
syntax-contrast helper keeps the scheme beside each finding itself. A
fault is now reported once, not once per scheme.

What to weigh:
- A fault that shows only in dark CSS, or only when a page first loads
540 px wide, is no longer reported.
- The render suite no longer runs the check over the shipped examples in
dark. Leaf's dark theme keeps its own tests, including code contrast in
both schemes over every example.
- Finding text drops its `[light]`/`[dark]` and `(at 540x720)` marks.
- The phone screenshots `page check --render` saves are unchanged.

This builds on #6127, which deleted `startup-layout-shift`.

Max asked to review keeping these, adding "we generally want to simplify
and remove where possible". Codex reviewed it and found no dangling
consumers of the removed fields, with every remaining check and the
saved screens still working.

Tests: 35 focused tests (render gate model, handover, and single
render-gate journey and browser tests); `pnpm run check:browser`. The
deleted tests covered constructed cases only: the #4704 timer page, a
card clipped only by a dark rule or a 720 px height, and `lf-dusk`,
whose words change only in dark.

> _This was written by Claude Code on behalf of max-sixty_
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