Skip to content

Name a module that keeps a page from starting in both render checks, in seconds - #6899

Merged
max-sixty merged 5 commits into
mainfrom
agent-adc30d5cc0b00ab49
Nov 24, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-adc30d5cc0b00ab49

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

When a package widget's module fails to link, as one importing a name its source doesn't export, both render checks now name the module and the browser's message within seconds. On main, leaf page check --render prints a traceback after 245 s and no report, and leaf package check --render exits after 246 s with the widget layer never finished upgrading, naming neither the module nor the export. Root AGENTS.md promises both commands report a module an update breaks, and a removed export is that case.

Both waits ran out for one reason: only a caller that passes fixed_server and opens the page at asked_again has wait_until_ready end on a page's own declaration that it cannot start. The gate's reader and page code's had that; the widget quality reader, the screens and leaf page picture did not, and now do. package check --render adds the errors the page reported to a wait that failed.

A page that is not ready when opened for a screen is now a not-ready finding in place of a traceback, and fails the check. A module that throws only on touch reports not-ready: opened for the phone screens, … in 5 s, where main printed a traceback after 249 s. page check --render takes no screens for a reading that stopped early or reported the page never got ready, so a page that upgrades and never gets ready prints its finding after one 240 s wait, where main printed a traceback after two. The screens taken before a page raised are removed with the temporary directory they were written to.

Measured on main at 93ebc4d and on this branch, for a widget importing TEXT_FIELD from /runtime/portable-api.js: page check --render exits 1 in 2.3 s with the no-runtime finding quoting "does not provide an export named 'TEXT_FIELD'", and package check --render in 3.0 s. A module that throws as it evaluates, and one importing a missing file, report in 2 to 3 s. No finding code or option is added, and the three places that built the not-ready finding now share one. Production code is +111 −53 over 10 files, not counting save_screens re-indented under its temporary directory, and tests +185 −4.

Left open. A Playwright error while taking the screens, such as a rendering that never settles, still ends the command in a traceback; that is read from the code, not run. package check --render draws at the desktop window only, so it passes a module that fails only on touch, and it passes a module that loads and defines nothing.

Tests. One browser test per command asserts the finding names the module and the missing export, a third runs the touch-only module through the real screens, and model tests cover the reading's new field and the skipped screens.

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

…, in seconds

A package widget whose module fails to link, as one that imports a name the
imported module doesn't export, keeps the page from starting, and the page says
so at once. Neither render check reported it:

- `leaf page check --render`, on a page whose only code is that widget, printed
  a traceback after 246 s and no report. The render gate's reading held the
  cause as a `no-runtime` finding within 2 s. The command then asked for screens
  of the same page, and the screens' wait ran to its 240 s deadline and raised.
- `leaf package check --render` exited 1 after 247 s with `unreadable-examples:
  the widget layer never finished upgrading: no progress in 240000ms`, which
  names neither the module nor the export.

Both waits ran out for one reason. A check reads a preview server that nothing
replaces, and `wait_until_ready` ends on a page's declaration that it cannot
start only for a caller that passes `fixed_server` and opens the page at
`asked_again`. #6114 and #6187 gave that to the render gate's reader and to
page code's. The widget quality reader, the screens and `leaf page picture`
still took the default wait, which waits for a replacement server.

What changes:

- The widget quality reader, the screens and `page picture` open the preview at
  `asked_again` and wait with `fixed_server`. `preview_server`'s docstring states
  the rule for the next reader of a preview.
- A render reading says whether the gate read the page through
  (`RenderReading.complete`, which was the third value
  `_render_version_attempt` returned). `page check --render` takes no screens
  for a reading that stopped early, since what stopped it would stop the
  screens' pages too.
- `package check --render` adds the errors the page reported to a wait that
  failed, as the `no-runtime` finding does, so a module that imports a missing
  file names that file. It lists those errors, and the errors of a page that
  did get ready, by their words alone; each used to carry its own guarantee
  inside the finding's.

Measured on a package with one widget that imports `TEXT_FIELD` from
`/runtime/portable-api.js`, and a page placing it, in Chrome:

- `page check --render`: exit 1 in 2.4 s with the `no-runtime` finding, which
  quotes "The requested module '/runtime/portable-api.js' does not provide an
  export named 'TEXT_FIELD'". In Firefox, 5 s.
- `package check --render`: exit 1 in 3.5 s with `unreadable-examples: widget
  examples could not be drawn: the runtime could not start: page failed to
  start: The requested module ...`.

A module that throws as it evaluates, and one that imports a file the package
lacks, take the same path and report in about 2 s from each command.

Two cases still end `page check --render` in a traceback instead of a report,
because nothing turns a failure of the screens into a finding:

- A page the reading found ready that cannot start for one of its screens, as a
  module that throws only on a touch device does on the phone screens. Run: the
  command raises `PageNotReady: the runtime could not start: ...` in 8 s, where
  the default wait would have run to its deadline.
- A page that upgrades and then never gets ready. The gate reads such a page to
  the end and reports `not-ready`, so its reading is complete, and the screens
  wait for the page again. Read from the code, not run.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
…raceback

`page check --render` takes its screens after the render reading, and nothing
turned a failure there into a finding. A page that was not ready when the check
opened it for a screen raised `PageNotReady` out of the command, which printed a
traceback and no report, so the findings the reading had made were lost. Two
pages reached that:

- A page ready at the desktop window that cannot start as a phone, as one whose
  module throws only on a device with touch input. The reading passed and the
  phone screens raised.
- A page that upgrades and never gets ready, as one whose widget declares work
  past presentation that never lands. The reading reported `not-ready` once its
  wait had gone 240 s without progress, then the screens waited for the same
  page again and raised.

What changes, in `render_gate.command.browser_check`:

- A `PageNotReady` raised while taking the screens joins the reading as a
  `not-ready` finding, which fails the check, and the check saves no screens.
  The maintainer's call, through the coordinating session on 24 November 2026:
  a page that cannot start on the phone screens fails the check, since
  `page check --render` is where a module an update breaks is reported.
- The screens are skipped where the reading already reported `not-ready`, as
  they are where it stopped early, so a page that never gets ready costs one
  wait.

`screens._open` says in the error which screens the page was opened for
("opened for the phone screens, ..."), since the reading found the page ready at
the desktop window, and closes the context it opened before raising. The three
places that build a `not-ready` finding from a `PageNotReady` now share
`scheme.unready_finding`.

Measured on two one-widget pages, in Chrome:

- Throws only on touch: before, a traceback in 4.7 s ending `PageNotReady: the
  runtime could not start: page failed to start: the module threw on a touch
  device` (on main, after 248.7 s and naming nothing). After, exit 1 in 5.2 s
  with `not-ready: opened for the phone screens, the runtime could not start:
  page failed to start: the module threw on a touch device`.
- Never gets ready: before, a traceback after 484.0 s. After, exit 1 in 243.9 s
  with `not-ready: work the page deferred past presentation never landed: no
  progress in 240000ms`.

A Playwright error raised while taking the screens, such as a rendering that
never settles, still leaves the command as a traceback. Read from the code, not
run.
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One small leak is noted inline. It doesn't block merging.

Comment thread src/leaf/render_gate/screens.py Resolved
`save_screens` writes a check's screens to a fresh directory beside the page's
screens directory and renames it into place at the end. A raise before the
rename left that directory behind in the state home. Since the previous commit
made a page that is not ready for its phone screens a reported finding, an
agent rerunning `page check --render` while it fixes such a module would leave
one `.screens-*` directory per run, each holding the desktop screens taken by
then.

The fresh directory is now a `tempfile.TemporaryDirectory`, which removes it
when its block ends on a raise. After the rename its cleanup finds no directory
at that path and removes nothing; run on Python 3.12.16 and 3.14.9, with
warnings as errors.

The test of a page that cannot start for its phone screens now also asserts
that the state home's screens directory holds nothing afterwards, and fails
without this change.

Found by the review bot on #6899.
@max-sixty
max-sixty merged commit 445c477 into main Nov 24, 2026
7 checks passed
@max-sixty
max-sixty deleted the agent-adc30d5cc0b00ab49 branch November 24, 2026 21:11
leaf-agent added a commit that referenced this pull request Nov 25, 2026
…rt, whichever wait reads it (#7111)

The render gate gave one page either of two findings, depending on
timing. It waits first for the runtime to start, then for the widget
layer to upgrade. Each wait ends on the page's own declaration that it
cannot start, but the first reported `no-runtime` and the second
`never-upgraded`. A widget module that fails to link makes that
declaration just after the runtime's chrome stands, so which finding the
gate reported depended on which poll saw it first. That is how
`test_a_render_check_names_the_import_a_package_module_fails_to_link`
failed on main in [run
45516663690](https://github.com/max-sixty/leaf/actions/runs/45516663690)
(`assert 'never-upgraded' == 'no-runtime'`), while it passes locally.

A declaration that the page cannot start is now `no-runtime`, whichever
wait reads it. Its text now reads "the runtime never started" in place
of "never injected its chrome", which is false once the chrome stands
before the failure. #6899's intent, naming the module and the missing
export within seconds, is unchanged.

**Verification.** The test gains a `once-read` case. Its widget module
is imported only once the gate's upgrade wait first reads the page's
`lfReadiness`, which forces the losing ordering from CI. On the old gate
that case fails with CI's exact assertion. With the change, both cases
pass, and so do the render gate's other `no-runtime` test and the
findings model tests.

<details><summary>Why the race exists</summary>

The gate's `runtimeStarted` probe looks for `.lf-floating-panel`. The
static panel row that bootstrap stands at first paint (#6383) carries
that class, so the start wait succeeds at its first poll. A trace of the
original module shows the order: row, then the runtime's own panel, then
the startup-error mark. The widget import runs in `upgradeWidgets`,
after the runtime has created its panel. So the declaration can land on
either side of the wait boundary. Making the probe ignore the static row
(`:not([data-lf-served])`) did not remove the race, so this change
leaves the probe as it is.

</details>

Refs #7110 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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