Skip to content

ci: install the harness's browser without apt-getting fonts - #13

Merged
Arman2122 merged 1 commit into
mainfrom
claude/adoring-cartwright-e6bd40
Nov 7, 2026
Merged

Arman2122 merged 1 commit into
mainfrom
claude/adoring-cartwright-e6bd40

Conversation

@Arman2122

@Arman2122 Arman2122 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Only the Browser harness job changes. The test it exists for runs exactly as before: same command, same MTG_REQUIRE_BROWSER_HARNESS=1.

Why

On 2026-10-23 the job hit its 10-minute timeout three times in an hour, every time inside npx playwright install --with-deps chromium-headless-shell. Examples are run 39949830616 attempt 1, 39947798647 attempt 1 and 39950087921 attempt 1. Two more runs passed but took 6 minutes in that step.

--with-deps always adds Playwright's "tools" group: xvfb and the fonts. Its CLI has no switch to leave it out (registry.installDeps does targets.add("tools") in 1.62.1). In the attempt that passed, apt said "already the newest version" for every library in the chromium group. So the 25.9 MB it fetched was:

  • new: fonts-ipafont-gothic, fonts-freefont-ttf, fonts-tlwg-loma-otf, fonts-unifont, fonts-wqy-zenhei, xfonts-cyrillic, xfonts-scalable, xfonts-encodings, xfonts-utils;
  • upgraded: patch versions of libglib2.0, libnss3, xvfb and xserver-common.

In the timed-out attempt the index fetch took 1 s, then packages came from azure.archive.ubuntu.com at about 40 KB/s. fonts-wqy-zenhei (7.5 MB) alone took 3 min 8 s.

The harness sets font-src 'none' and takes no screenshots, so the fonts were never part of what it tests.

What

  • npx playwright install chromium-headless-shell, without --with-deps.
  • A new step, "Check the browser's system libraries", runs the browser from test/webbridge the way the harness does: chromium.launch(), newPage(), setContent(), close(). The launch fails if the binary cannot load a library it links against, and the page starts a renderer.
    • If it passes, apt is never touched.
    • If it fails, the step emits a ::warning:: and runs npx playwright install-deps chromium-headless-shell. That is a correctness net for a future image, not a speed path, because it brings the fonts back. The warning says so.
  • Playwright's own host-dependency check is not usable here. In 1.62.1 it runs ldd over chrome-linux/, but the x64 headless shell unpacks to chrome-headless-shell-linux64/, so it checks nothing. That is why the probe launches the browser for real.

Measured

All durations are per-step times from the Actions API, in whole seconds.

Before. All 19 Browser harness jobs on 2026-10-23 with the old --with-deps step:

Jobs Install Chromium Whole job
Fast 14 16–28 s (median 18 s) 50–62 s
Slow, passed 2 359 s, 376 s 400 s, 417 s
Timed out 3 cancelled at ~590 s 617 s

After. Every job below ran without touching apt: the probe passed, and there was no fallback and no warning. All 24 harness checks passed every time.

Run / attempt Commit Image Install Chromium Probe Whole job
39955344880 #1 be224d1 (this PR) ubuntu-24.04 20261012.334.1 5 s 2 s 51 s
39955344880 #2 be224d1 ubuntu-24.04 20261012.334.1 6 s 1 s 47 s
39955344880 #3 be224d1 ubuntu-24.04 20261012.334.1 4 s 1 s 37 s
39955344880 #4 be224d1 ubuntu-24.04 20261012.334.1 5 s 0 s 39 s
39955344880 #5 be224d1 ubuntu-24.04 20261012.334.1 5 s 2 s 43 s
39954786314 #1 1ae11d4 (first push) ubuntu-24.04 20261012.334.1 6 s 1 s 45 s
39954786314 #2 1ae11d4 ubuntu-24.04 20261012.334.1 6 s 1 s 42 s
39954879316 #1 experiment ubuntu-26.04 20261012.163.1 6 s 1 s 45 s

1ae11d4 is the first push of this PR. It runs the same commands; only the comment wording and the probe's success message differ.

Install Chromium went from 16–28 s (median 18 s) to 4–6 s (median 5 s over the five attempts on be224d1), plus a 0–2 s probe. The whole job went from 50–62 s to 37–51 s. Most of what is left is go test building the package.

The fallback, and the slow mirror again. The two experiments ran on a temporary commit, 512fdb3, which has since been force-pushed away and is not part of this PR. It added a copy of the job on ubuntu-26.04 (the row above) and forced the probe to fail on 24.04, to exercise the fallback.

In run 39954879316 attempt 1, the forced fallback emitted its warning and ran install-deps. That apt install then hit the 10-minute timeout, because the mirror was slow again from 12:41 to 12:51: fonts-wqy-zenhei (7,472 kB) took 182 s, about 41 KB/s. In that same window, 39955344880 #1 and #2 and 39954786314 #2 installed in 5–6 s, because they never touch apt.

I reran the forced-fallback job once (39954879316 attempt 2, 12:56–13:06), and it timed out the same way: fonts-wqy-zenhei took 183 s. So the mirror was slow from at least 12:41 to 13:06. The no-apt attempts above ran between 12:45 and 12:54 and were not affected. I did not rerun it again.

What this shows about the fallback:

  • Observed: the warning fires and install-deps starts and runs.
  • Not observed: the fallback completing, because the mirror never recovered while it ran. After install-deps the job runs the same commands as the old --with-deps step, which passed 16 times today.
  • On 26.04: the fallback was never needed, because the probe passed. That it would work there is inferred from Playwright 1.62.1 having an ubuntu26.04 dependency table. It was not observed.

Not done

  • Caching the browser. The 114.7 MiB shell downloads from cdn.playwright.dev in about 3.5 s, so a cache restore of the same size would not be faster. It would also add the Actions cache service as one more thing that can be slow.
  • Raising the timeout. The normal path no longer goes near it.
  • Pinning the runner image. The probe doesn't assume an image, and the 26.04 run above needed no apt at all, so the job stays on ubuntu-latest like the others.

The Browser harness job ran `playwright install --with-deps`, and on
2026-10-23 it hit its ten-minute timeout three times in an hour, always
inside that step. Playwright's dependency install always adds its
"tools" group, xvfb and its font packages, on top of the browser's own
libraries. On the ubuntu-24.04 image every one of those libraries is
already installed: the passing run reports "already the newest version"
for each. So what --with-deps actually did was apt-get about 26 MB, the
fonts plus patch upgrades of libglib2.0, libnss3 and xvfb, from
azure.archive.ubuntu.com. That mirror answered the index fetch in a
second and then served the packages at about 40 KB/s; fonts-wqy-zenhei
alone, 7.5 MB, took three minutes.

The browser is now installed without system packages, and a new step
finds out whether the runner can run it by running it: a launch fails
if the binary cannot load a library it links against, and opening a
page starts a renderer. Playwright's own host-dependency check does not
help here; in 1.62.1 it runs ldd over chrome-linux/, and the x64
headless shell unpacks to chrome-headless-shell-linux64/, so it checks
nothing. If the probe passes, nothing touches apt. If it fails, as it
might on a later image while ubuntu-latest moves to a new Ubuntu
release, the job falls back to `playwright install-deps` and says so in
a warning, because that path brings the fonts and the slow-mirror
exposure back. Playwright 1.62.1 has a dependency table for Ubuntu
26.04, so the fallback works there too.

None of this touches what is tested. The harness forbids fonts in its
own policy (font-src 'none') and takes no screenshots, and the test
step, its MTG_REQUIRE_BROWSER_HARNESS and its command are unchanged: a
browser that cannot start still fails the job.

The browser download itself is not cached. The 114.7 MiB headless shell
came from cdn.playwright.dev in about 3.5 s; restoring a cache of the
same size would not be faster.
@Arman2122
Arman2122 force-pushed the claude/adoring-cartwright-e6bd40 branch from 512fdb3 to be224d1 Compare October 23, 2026 12:42
@Arman2122
Arman2122 merged commit d670275 into main Nov 7, 2026
38 checks passed
@Arman2122
Arman2122 deleted the claude/adoring-cartwright-e6bd40 branch November 20, 2026 12:19
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.

1 participant