Skip to content

Close browsers gracefully, and run dev evals on Chrome for Testing - #3355

Merged
max-sixty merged 3 commits into
mainfrom
graceful-browser-close
Oct 20, 2026
Merged

max-sixty merged 3 commits into
mainfrom
graceful-browser-close

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

On macOS, every launch of Google-signed Chrome runs a Secure Enclave self-test that creates two keychain keys and deletes them when it finishes. A Chrome that ends first leaves both behind, and nothing ever collects them. Every leaked key makes each later keychain read in Chrome slower. Since #1691, ending() has SIGKILLed the browser's process group after each render gate run, because installed Chrome's graceful close took about 4 s. That slow close was itself caused by leaked keys, so the kill fed the cost it was avoiding. One Mac reached about 27k keys, which kept secd at 50–70% CPU.

Close gracefully. ending() is gone, and every browser closes through Playwright's own context manager. The headless shell, Chrome for Testing and Firefox close in 0.02–0.3 s, so dropping the kill costs nothing there: page check --render on the shell takes 5.2–5.6 s either way. Installed Chrome 157 (Stable 2026-11-03) delays the self-test by 45 s and runs it on only 1 Mac Stable launch in 64, so short checks will stop creating keys once users update. Until then, on a Mac whose keychain is already bloated, a check with installed Chrome can take up to about 10 s to close.

Dev evals on Chrome for Testing. eval-ui-review, the ui-review-detection provider and the arrangement eval's judge now launch Chrome for Testing, which has no keychain entitlement, instead of installed Chrome. It is a full Chrome build, so unlike the headless shell it still reports the autofill layer's form issues. eval-ui-review needs its screenshots and the model's live tool to come from one build, but the Python (1.63) and Node (1.64) Playwright pins resolved different Chromium builds. So the Python lock moves to Playwright 1.64.0. Both sides now launch Chrome for Testing 156, and the suite's headless shell moves from 153 to the same build.

leaf-dev setup installs the full Chromium build beside the shell, about 360 MB more per fresh setup. It still installs branded Chrome, because the render gate's default-channel journey test launches it on purpose.

Tested locally on macOS: the pre-merge selection (1,912 passed), and Chrome for Testing launched from both Node and Python Playwright, including through the judge's playwright-cli --browser=chromium.

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

max-sixty and others added 3 commits October 20, 2026 10:48
`ending()` SIGKILLed the browser's process group after every render gate
run (#1691), because installed Chrome's graceful shutdown took about 4 s.
On macOS that kill is what leaks keychain keys: each Google Chrome launch
runs a Secure Enclave self-test that creates two keys and deletes them
when it finishes, and a Chrome ended first leaves both behind. Every
leaked key makes each later keychain read in Chrome slower, which is
what made the graceful close slow, so the kill fed the cost it avoided.
One Mac reached ~27k keys and kept secd at 50-70% CPU.

The headless shell, Chrome for Testing and Firefox close in 0.02-0.3 s,
so the kill saved nothing for them; `page check --render` with the shell
times the same either way. Chrome 157 delays the self-test by 45 s and
samples it, so a short check with installed Chrome will create no keys
once users update. Until then a check with installed Chrome closes in
up to ~10 s on a Mac whose keychain is already bloated.

Browsers now close through Playwright's own context manager, and
`ending()` is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`eval-ui-review`, the ui-review-detection provider and the arrangement
eval's judge launched installed Google Chrome. On macOS every such launch
runs Chrome's Secure Enclave self-test, and a Chrome ended before it
finishes leaves two keychain keys behind. Chrome for Testing is a full
Chrome build with no keychain entitlement, so it creates none, and unlike
the headless shell it reports the autofill layer's form issues (a field
with neither id nor name), which is why these evals wanted full Chrome.

eval-ui-review needs its screenshots and the model's live tool to be one
build, and the Python and Node Playwright pins resolved different
Chromium builds (1.63 → 1243, 1.64 → 1248). The Python lock moves to
Playwright 1.64.0 so `channel="chromium"` names the same Chrome for
Testing 156 on both sides; the suite's headless shell moves from 153 to
the same build. `leaf-dev setup` now installs the full Chromium build
beside the shell. It still installs branded Chrome, which the render
gate's default-channel journey test launches on purpose.

The recorded `environment.json` key is now `browser`, since it is no
longer Chrome's version.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 8c7efd3 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the graceful-browser-close branch October 20, 2026 18:16
leaf-agent added a commit that referenced this pull request Oct 20, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/39475232229) failed
in 22 browser cases after #3355 moved Python Playwright from 1.63 to
1.64. The new browser changed scrolling behavior across reading-place,
pane, margin, and touch tests; its trace format also changed from 9 to
10, which the bundled importer rejects. With the current source and
Playwright 1.63, every reported failed case passes. This PR pins both
Python and Node Playwright to 1.63, keeping the two eval clients on the
same Chrome for Testing build while preserving #3355's graceful browser
shutdown.

Verification: all 22 reported failed cases pass locally with the new
pins, including the trace importer and feature gallery; the
short-workspace reading cue case passes; `pnpm run check` and pre-commit
pass. The focused figure resize case and trace import both failed with
1.64 on the same source, then passed with 1.63. Restoring 1.64 will
require reconciling its browser behavior and trace format.

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