Conversation
AGENT_BROWSER_CHROME_FLAGS is not read by agent-browser CLI. The correct env var is AGENT_BROWSER_ARGS, with comma-separated values. This fixes Chrome 'No usable sandbox' crash on Ubuntu 23.10+ systems where AppArmor restricts unprivileged user namespaces. The detection logic was correct but the fix used the wrong environment variable name and space-separated instead of comma-separated args.
Contributor
Collaborator
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.
Bug
On Ubuntu 23.10+ (and other distros with AppArmor unprivileged user namespace restrictions),
browser_navigatecrashes with:The detection logic in
tools/browser_tool.pycorrectly identifies the AppArmor restriction and attempts to inject--no-sandbox, but passes it via the wrong environment variable.Root Cause
Lines 1873-1876 set
AGENT_BROWSER_CHROME_FLAGS, butagent-browserCLI readsAGENT_BROWSER_ARGS(seeagent-browser --help:--args <args> Browser launch args (or AGENT_BROWSER_ARGS)).Additionally, the value uses space-separation (
"--no-sandbox --disable-dev-shm-usage") butagent-browserexpects comma-separated values.Fix
Two-line change in
tools/browser_tool.py:Testing
Tested on Ubuntu with
apparmor_restrict_unprivileged_userns = 1, Playwright Chromium 147.0.7727.15, agent-browser 0.27.0.Checklist