Skip to content

fix(ci): re-enable unprivileged user namespaces for the browser gates - #2

Merged
laithalsaadoon merged 1 commit into
mainfrom
fix/ci-chromium-userns-sandbox
Aug 13, 2026
Merged

laithalsaadoon merged 1 commit into
mainfrom
fix/ci-chromium-userns-sandbox

Conversation

@laithalsaadoon

Copy link
Copy Markdown
Contributor

Problem

@memhtml/docs#test:budget fails on every CI run (the last four pushes to main, plus PR #1) with Unable to connect to Chrome. The chrome-err.log in the Lighthouse output has the actual cause:

FATAL:content/browser/zygote_host/zygote_host_impl_linux.cc:128] No usable sandbox!
If you are running on Ubuntu 23.10+ or another Linux distro that has disabled
unprivileged user namespaces with AppArmor...

The ubuntu-latest runner image restricts unprivileged user namespaces through AppArmor, and Chrome's zygote sandbox requires them, so headless Chrome aborts with SIGABRT before Lighthouse can connect.

Fix

One step in check.yml before mise run check:

- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

This restores the namespace the sandbox needs, so CI drives the same sandboxed Chrome a laptop does.

Alternative considered

chromeFlags: --no-sandbox in lighthouserc.json also fixes it (verified locally: with the flag, lhci autorun passes all assertions on all four URLs). Rejected because that file drives local runs too, and it would remove Chrome's sandbox everywhere to work around one CI image's policy.

Verification

  • The budget gate itself is healthy: pnpm run test:budget passes locally on the current dist, all assertions, 4 URLs x 3 runs.
  • The a11y gate launches Chromium through Playwright's own launcher, which handles the sandbox differently, and has not been failing; this change does not affect it either way.
  • This PR's own check run is the real test: the budget gate should go green on the runner for the first time in four pushes.

Ubuntu 24.04 runners ship an AppArmor policy that blocks unprivileged
user namespaces, and Chrome's zygote sandbox requires them. The budget
gate's headless Chrome has aborted at launch with 'No usable sandbox!'
(zygote_host_impl_linux.cc:128) on every run since the runner image
rolled forward, failing @memhtml/docs#test:budget while all other
tasks pass.

Setting kernel.apparmor_restrict_unprivileged_userns=0 for the job
restores the namespace the sandbox needs. The gate itself is healthy:
run locally, lhci autorun passes all assertions on all four URLs. The
alternative, --no-sandbox in lighthouserc.json, was rejected because
that file also drives local runs and would remove the sandbox
everywhere to fix one CI image.
@laithalsaadoon
laithalsaadoon merged commit 7eaad04 into main Aug 13, 2026
5 checks passed
@laithalsaadoon
laithalsaadoon deleted the fix/ci-chromium-userns-sandbox branch August 13, 2026 19:15
laithalsaadoon added a commit that referenced this pull request Oct 16, 2026
apps/docs no longer depends on @lhci/cli, and `mise run check` no longer
runs `test:budget`. The accessibility gate (axe through Playwright) and
the layout-stability probe keep the WCAG 2.2 AA and CLS checks; no
Lighthouse score gates the build.

Removed with it, each proven before removal:

- apps/docs/lighthouserc.json and the three built-site cases that read
  it. The URL-parity case is moot with one config; the base-segment case
  stays and the browser-suite registration case stays.
- test:budget in apps/docs/package.json, the root package.json,
  turbo.json and mise.toml; `lint` no longer names lighthouserc.json.
- The apparmor sysctl step in check.yml and release-please.yml. It
  existed for lhci's sandboxed Chrome (#2). Playwright 1.64.0 passes
  --no-sandbox unless chromiumSandbox is true (coreBundle.js:44764), and
  neither a11y.test.ts nor layout-stability.test.ts sets it, so the
  remaining gate never needed the namespace.
- The tmp and uuid pnpm overrides, and the extract-zip OpenVEX
  statement with its generated osv-scanner.toml entries. `pnpm why -r`
  on main shows all three reach the lockfile through @lhci/cli alone
  (tmp also via inquirer, itself under @lhci/cli), and the refreshed
  lockfile carries none of them. The ledger keeps its document fields
  with an empty statements list (version 2, last_updated set); grype
  0.120.1, trivy 0.75.0 and osv-scanner 2.7.0 each accept the empty
  ledger and report the finding again against a probe lockfile.
- .gitignore entries for .lighthouseci/ and .lhci-site/.

The lockfile loses 370 package entries and gains none; the five keys
that show as added are unchanged entries git re-anchored.

Why: the lhci tree has cost upkeep since the gate landed. lighthouse's
trace_engine resolves two dependencies from `latest`, which moved the
lockfile on 2026-09-24 and 2026-10-12, and the 2026-09-30 qs advisories
needed an express refresh through @lhci/cli (#230).

verdict-bench item 57 (sod-0914:memhtml-lhci-drop-pr): Laith ruled go
at 15:12 CT 2026-10-12.
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