Skip to content

Name the headless shell as the suite's browser for every leaf it runs - #1488

Merged
max-sixty merged 2 commits into
mainfrom
suite-headless-render-gate
Oct 1, 2026
Merged

max-sixty merged 2 commits into
mainfrom
suite-headless-render-gate

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The suite's _browser fixture drives Playwright's pinned headless shell, but a leaf page check the suite runs named no browser. So each check that ran a page's own code or took --render launched the installed Google Chrome afresh through channel="chrome". On macOS, each new Chrome process also costs the keychain daemon (secd) about a second of CPU.

headless_shell is now a session autouse fixture that sets LEAF_BROWSER_EXECUTABLE for the whole run, and the one test that passed the variable by hand no longer does. Tests about browser resolution itself still clear or set the variables (unnamed_browser, monkeypatch.delenv).

Behavior moved: those checks draw with the pinned shell rather than the host's Chrome, or on the GitHub runner, whatever CHROME_BIN names.

Measured on macOS over a regular pytest tests run: installed-Chrome launches went from 11 to 0, with 1453 passed both times. In a loop of 10 launches, installed Chrome cost 0.7–1.2 s of secd CPU and about 3.5 s wall per launch; the shell cost 0 s and about 0.34 s.

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

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 29, 2026 20:05
The suite's own `_browser` fixture drives Playwright's pinned headless shell,
but a `leaf page check` the suite runs, as a subprocess or in process, named no
browser, so each one that ran a page's code or took `--render` launched the
installed Google Chrome afresh. `headless_shell` is now a session autouse
fixture that sets LEAF_BROWSER_EXECUTABLE for the run, and the one test that
passed it by hand no longer does. Tests about resolution itself still clear or
set the variables (`unnamed_browser`).

Behavior moved: those checks draw with the pinned shell rather than the
host's Chrome (or, on the GitHub runner, whatever CHROME_BIN names).

Measured on macOS over a regular `pytest tests` run: installed-Chrome launches
11 → 0; 1453 passed both times. Per launch, installed Chrome cost 0.7–1.2 s
of secd CPU and ~3.5 s wall, the shell 0 s and ~0.34 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 12432f6 into main Oct 1, 2026
5 checks passed
@max-sixty
max-sixty deleted the suite-headless-render-gate branch October 1, 2026 01:56
max-sixty added a commit that referenced this pull request Oct 13, 2026
…hell (#2786)

#1488 named the pinned headless shell as the suite's browser, but
`leaf-dev` still reached the host's browser through `launch_browser`,
which picks installed Google Chrome. Every `leaf-dev stills`, `probe`,
eval, journey and `verify-site` run, and every `leaf page check` a
leaf-dev child ran, launched Chrome with a fresh profile.

On macOS that cost has grown since #1488 measured about a second of
`secd` CPU per launch. Each fresh profile leaves a key in Chrome's
`unexportable-keys` keychain group, and every later Chrome launch makes
`secd` read all of them back. On the maintainer's Mac the group holds
27,188 keys, and one read took 5.6 s of `secd` CPU; agent sessions
running stills and page checks kept `secd` at 50–70%.

## What changes

- **`leaf_dev.browser.headless_shell()`** (was `chrome()`) launches
Playwright's pinned headless shell, the build `_browser` drives. Every
caller is renamed, and `refresh-previews` uses it instead of launching
the shell itself.
- **`leaf_dev.browser.shell_executable()`** now owns the shell lookup
that was in the suite's `headless_shell` fixture. The fixture calls it,
and `arms.environment()` names it as `LEAF_BROWSER_EXECUTABLE` for every
`leaf` and agent child, unless `LEAF_BROWSER_EXECUTABLE` is already set.
It outranks `CHROME_PATH` and `CHROME_BIN`, which hosts set for other
tools (GitHub's runner sets `CHROME_BIN` to its Chrome), as the suite's
fixture already does. Page checks inside evals, journeys, `bench-check`
and the site build draw with the shell too.
- **`eval-ui-review` keeps installed Chrome**, now launched explicitly:
its `provider.mjs` gives the model's live tool installed Chrome, so the
screenshots and the recorded version stay on the same build.
- **`publish-site` installs the shell.** Its `deploy-site` job ran
`verify-site` and the journey on the runner's preinstalled Chrome, with
no Playwright install.

The product's own launch order (`launch_browser`: named executable, then
installed Chrome, then `PATH`) is unchanged, since a user's host has no
Playwright shell. One consequence for evals: an agent's `page check`
there no longer raises Chrome's autofill-layer DevTools issues, which
the shell doesn't report (`render_gate/readings.py`).

`notes/browser-support.md`'s recheck for installed Chrome now uses a
`channel="chrome"` one-liner, since `leaf-dev probe` reads the shell.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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