Repository navigation
Name the headless shell as the suite's browser for every leaf it runs - #1488
Merged
Merged
Conversation
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]>
…-gate # Conflicts: # tests/conftest.py
leaf-agent
approved these changes
Oct 1, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The suite's
_browserfixture drives Playwright's pinned headless shell, but aleaf page checkthe suite runs named no browser. So each check that ran a page's own code or took--renderlaunched the installed Google Chrome afresh throughchannel="chrome". On macOS, each new Chrome process also costs the keychain daemon (secd) about a second of CPU.headless_shellis now a session autouse fixture that setsLEAF_BROWSER_EXECUTABLEfor 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_BINnames.Measured on macOS over a regular
pytest testsrun: 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 ofsecdCPU and about 3.5 s wall per launch; the shell cost 0 s and about 0.34 s.🤖 Generated with Claude Code