Skip to content

fix(browser): inject --no-sandbox via cmd_parts instead of AGENT_BROWSER_CHROME_FLAGS - #24930

Closed
wyv202011y wants to merge 1 commit into
NousResearch:mainfrom
wyv202011y:fix/browser-chrome-flags-agent-browser-026
Closed

fix(browser): inject --no-sandbox via cmd_parts instead of AGENT_BROWSER_CHROME_FLAGS#24930
wyv202011y wants to merge 1 commit into
NousResearch:mainfrom
wyv202011y:fix/browser-chrome-flags-agent-browser-026

Conversation

@wyv202011y

Copy link
Copy Markdown

agent-browser 0.26+ no longer honours the AGENT_BROWSER_CHROME_FLAGS environment variable. The old approach of setting browser_env["AGENT_BROWSER_CHROME_FLAGS"] = "--no-sandbox --disable-dev-shm-usage" was silently ignored, causing the sandbox bypass to fail on systems that need --no-sandbox (root, AppArmor userns-restricted systems).

Fix: inject --args directly into cmd_parts before the --json flag, bypassing the env-var mechanism entirely. Each flag gets its own element in the list, matching agent-browser's CLI argument parser.

Also removes --disable-dev-shm-usage which is no longer needed and was causing issues with agent-browser's argument parsing.

…SER_CHROME_FLAGS

agent-browser 0.26+ no longer honours the AGENT_BROWSER_CHROME_FLAGS
environment variable. The old approach of setting:
  browser_env["AGENT_BROWSER_CHROME_FLAGS"] = "--no-sandbox --disable-dev-shm-usage"

was silently ignored, causing the sandbox bypass to fail on systems
that need --no-sandbox (root, AppArmor userns-restricted systems).

Fix: inject --args directly into cmd_parts before the --json flag,
bypassing the env-var mechanism entirely. Each flag gets its own
element in the list, matching agent-browser's CLI argument parser.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) labels May 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related: This enters a crowded field of competing PRs for the same AGENT_BROWSER_CHROME_FLAGS → sandbox bypass issue (#23496): #24198, #22582, #21659, #20014, #23517. This PR takes a different approach (injecting --args into cmd_parts) vs the env-var rename approach of the others. #24821 was already marked duplicate of #24198.

@teknium1

Copy link
Copy Markdown
Contributor

Closing in favor of PR #25988, which uses the env-var approach from @Jaggia's #24821. Your diagnosis was correct — AGENT_BROWSER_CHROME_FLAGS was indeed dead — but agent-browser does honor AGENT_BROWSER_ARGS as an env var (parsed in daemon.js via split(/[,\\n]/)), so the env-var swap is a smaller, less invasive fix than threading --args through cmd_parts. Thanks for the report.

#25988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants