fix(browser-preview): detect any cached Playwright Chromium revision - #204
Merged
Conversation
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
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.
Problem
resolve_browser_path()named two Chromium revisions explicitly:Playwright installs each build under
chromium-<revision>and prunes old ones, so apinned list goes stale on the next
playwright install. It degrades quietly: detectionfalls 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-1208andchromium-1228, andwas resolving 1208.
Change
Scan the cache directory instead of naming revisions:
chromium-<rev>andchromium_headless_shell-<rev>entries, newest revision firstchrome-linux64/chrome, olderchrome-linux/chrome,and the macOS
chrome-mac/Chromium.app/…pathSystem Chrome (
/usr/bin/google-chrome*,/usr/bin/chromium) still takes precedence, andGSD_BROWSER_BROWSER_PATHstill short-circuits everything.Verification
firefox-*/ dotfile entries ignored, andthe absent-cache case.
apps/server/src/browser-preview10/10.~/.cache/ms-playwright/chromium-1228/chrome-linux64/chrome(previously 1208).fmt:checkclean.Found while smoke-testing a freshly installed
gsd-browser0.2.2. Note that this is notwhy
/browsercurrently fails on that host — Chrome dies at launch there becausekernel.apparmor_restrict_unprivileged_userns=1blocks its sandbox, which is a separatehost-side decision.
🤖 Generated with Claude Code