v1.40.0.1 fix(browse): enable Chromium sandbox on headed launchPersistentContext#1617
Open
garrytan wants to merge 1 commit into
Open
v1.40.0.1 fix(browse): enable Chromium sandbox on headed launchPersistentContext#1617garrytan wants to merge 1 commit into
garrytan wants to merge 1 commit into
Conversation
…tentContext Playwright auto-adds --no-sandbox whenever chromiumSandbox !== true (playwright-core/lib/server/chromium/chromium.js:291-292). The headless chromium.launch() site set the option; the two headed sites (launchHeaded() and handoff()) did not. Every headed launch on macOS and Linux showed Chromium's yellow "unsupported command-line flag: --no-sandbox" infobar. Introduces shouldEnableChromiumSandbox() — centralizes the Win32 / CI / CONTAINER / root heuristic that previously lived only in the headless path's explicit --no-sandbox push at :225. All three launch sites now use the helper, and six unit tests pin the policy across darwin, linux, win32, CI, CONTAINER, and root. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
E2E Evals: ✅ PASS8/8 tests passed | $1.32 total cost | 12 parallel runners
12x ubicloud-standard-8 (Docker: pre-baked toolchain + deps) | wall clock ≈ slowest suite |
garrytan
added a commit
that referenced
this pull request
May 20, 2026
Mirrors v1.40.0.1 from main lineage (PR #1617). Cherry-picked onto gbrowser-anti-detection so the GBrowser submodule can consume the fix without waiting for main to merge. Playwright auto-adds --no-sandbox whenever chromiumSandbox !== true (playwright-core/lib/server/chromium/chromium.js:291-292). The headless chromium.launch() site set the option; the two headed sites (launchHeaded() and handoff()) did not. Every headed launch on macOS and Linux showed Chromium's yellow "unsupported command-line flag: --no-sandbox" infobar. shouldEnableChromiumSandbox() centralizes the Win32 / CI / CONTAINER / root heuristic that previously lived only in the headless path's explicit --no-sandbox push at :225. All three launch sites now use the helper, and six unit tests pin the policy across darwin, linux, win32, CI, CONTAINER, and root. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Playwright auto-adds
--no-sandboxwheneverchromiumSandbox !== true(playwright-core/lib/server/chromium/chromium.js:291-292). The headless
chromium.launch()siteset the option; the two headed sites —
launchHeaded()andhandoff()— did not. Every headedlaunch on macOS and Linux therefore showed Chromium's yellow "unsupported command-line flag:
--no-sandbox" infobar across the top of the first tab.
This PR introduces
shouldEnableChromiumSandbox()to centralize the Win32 / CI / CONTAINER /root heuristic that previously lived only in the headless path's explicit
--no-sandboxpushat
:225. All three launch sites now share the same policy.browse/src/browser-manager.ts:244(launch()) — switchesprocess.platform !== 'win32'toshouldEnableChromiumSandbox()browse/src/browser-manager.ts:416(launchPersistentContext()) — adds the helperbrowse/src/browser-manager.ts:1304(handoff()) — adds the helperThe explicit
--no-sandboxpush at:225stays as a harmless defensive duplicate; Playwrightwill auto-add
--no-sandboxanyway when the helper returns false, but the redundancy makes theintent obvious to readers in container/root environments.
Test plan
bun test browse/test/browser-manager-unit.test.ts— 8 tests pass, including 6 new pinningshouldEnableChromiumSandboxacross darwin / linux / win32 / CI / CONTAINER / rootbun test browse/test/browser-manager-custom-chromium.test.ts— still green--no-sandboxinfobar gone🤖 Generated with Claude Code