fix(browser): inject --no-sandbox for root and AppArmor userns restrictions#19747
Merged
Conversation
…ctions
On VPS/Docker and some Ubuntu 23.10+ hosts, Chromium refuses to start
without --no-sandbox:
- uid=0 (root): hard requirement (VPS/Docker deployments)
- AppArmor apparmor_restrict_unprivileged_userns=1 (Ubuntu 23.10+):
non-root too, under systemd or unprivileged containers
Detect both conditions and inject AGENT_BROWSER_CHROME_FLAGS with
--no-sandbox --disable-dev-shm-usage when the user hasn't already
set the flags themselves.
Salvage of #15771 — only the browser_tool.py fix is cherry-picked.
The PR's accompanying MCP preset addition (new feature surface)
was dropped so the bug fix can land independently.
Co-authored-by: ygd58 <buraysandro9@gmail.com>
This was referenced May 19, 2026
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.
Salvage of #15771 by @ygd58 — core browser fix only.
Summary
On VPS/Docker deployments and some Ubuntu 23.10+ hosts, Chromium refuses to start without
--no-sandbox:apparmor_restrict_unprivileged_userns=1: Ubuntu 23.10+ also restricts non-root users under systemd or unprivileged containersDetect both conditions and inject
AGENT_BROWSER_CHROME_FLAGS="--no-sandbox --disable-dev-shm-usage"when the user hasn't already set the flags themselves. Without this fix,browser_navigatehangs until the command timeout fires (~30s) before surfacing an obscure error.Adaptation during salvage
The original PR also added a Playwright MCP preset with matching root-safe flags. That's a net-new feature surface, not a bug fix, so it was dropped from this salvage — the underlying browser fix stands on its own and helps every agent-browser user on affected systems.
Changes
Validation
Pre-existing failures in
test_browser_chromium_check.pyon main are unrelated to this change (same failures with or without it).Original PR: #15771
Fixes: #15765