Skip to content

fix(browser-preview): detect any cached Playwright Chromium revision - #204

Merged
Ecko95 merged 1 commit into
gitsfrom
fix/playwright-chromium-detection
Aug 9, 2026
Merged

fix(browser-preview): detect any cached Playwright Chromium revision#204
Ecko95 merged 1 commit into
gitsfrom
fix/playwright-chromium-detection

Conversation

@Ecko95

@Ecko95 Ecko95 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Problem

resolve_browser_path() named two Chromium revisions explicitly:

`${HOME}/.cache/ms-playwright/chromium-1223/chrome-linux64/chrome`,
`${HOME}/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome`,

Playwright installs each build under chromium-<revision> and prunes old ones, so a
pinned list goes stale on the next playwright install. It degrades quietly: detection
falls back to an older build, then fails outright once both are pruned and the browser
panel reports no Chrome.

vps-eu was already in the first state — it has chromium-1208 and chromium-1228, and
was resolving 1208.

Change

Scan the cache directory instead of naming revisions:

  • keep chromium-<rev> and chromium_headless_shell-<rev> entries, newest revision first
  • expand each to the known layouts: chrome-linux64/chrome, older chrome-linux/chrome,
    and the macOS chrome-mac/Chromium.app/… path
  • a missing cache directory yields no candidates rather than throwing

System Chrome (/usr/bin/google-chrome*, /usr/bin/chromium) still takes precedence, and
GSD_BROWSER_BROWSER_PATH still short-circuits everything.

Verification

  • Two tests: newest-revision-first ordering with firefox-* / dotfile entries ignored, and
    the absent-cache case. apps/server/src/browser-preview 10/10.
  • Against the live cache on vps-eu: 12 candidates, resolves
    ~/.cache/ms-playwright/chromium-1228/chrome-linux64/chrome (previously 1208).
  • Typecheck, oxlint, and fmt:check clean.

Found while smoke-testing a freshly installed gsd-browser 0.2.2. Note that this is not
why /browser currently fails on that host — Chrome dies at launch there because
kernel.apparmor_restrict_unprivileged_userns=1 blocks its sandbox, which is a separate
host-side decision.

🤖 Generated with Claude Code

resolve_browser_path() named two Chromium revisions (1223, 1208)
explicitly. Playwright installs each build under chromium-<revision> and
prunes old ones, so the list goes stale on the next `playwright install`
and detection silently falls back to an older build — or fails outright
once both are pruned. This host already had 1228 alongside 1208 and was
resolving the older one.

Scan the cache directory instead: keep chromium-<rev> and
chromium_headless_shell-<rev> entries, newest revision first, expanded to
the known layouts (chrome-linux64, older chrome-linux, and the macOS
Chromium.app path). A missing cache directory yields no candidates rather
than throwing. System Chrome still wins, and GSD_BROWSER_BROWSER_PATH
still short-circuits everything.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MT3yahYydujMapNrKYgVpJ
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Aug 9, 2026
@Ecko95
Ecko95 merged commit 6515b76 into gits Aug 9, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant