Skip to content

fix(browser_tool.py): use AGENT_BROWSER_ARGS for sandbox bypass - #31136

Closed
tsella wants to merge 1 commit into
NousResearch:mainfrom
tsella:fix/browser-env-var-name
Closed

fix(browser_tool.py): use AGENT_BROWSER_ARGS for sandbox bypass#31136
tsella wants to merge 1 commit into
NousResearch:mainfrom
tsella:fix/browser-env-var-name

Conversation

@tsella

@tsella tsella commented May 23, 2026

Copy link
Copy Markdown

Problem

The auto-detection logic that injects --no-sandbox on AppArmor-restricted systems (Ubuntu 23.10+) sets the wrong environment variable.

agent-browser v0.26.0 reads AGENT_BROWSER_ARGS (comma-separated), but Hermes was setting AGENT_BROWSER_CHROME_FLAGS which agent-browser ignores entirely.

Impact

  • Chromium crashes with "No usable sandbox!" on systems where /proc/sys/kernel/apparmor_restrict_unprivileged_userns == 1
  • The auto-detection code runs correctly but silently fails because the wrong env var is passed

Changes

  • Rename env var: AGENT_BROWSER_CHROME_FLAGSAGENT_BROWSER_ARGS
  • Adjust flag format: space-separated → comma-separated
  • Add inline comment documenting the agent-browser env var contract

Verification

Tested on Ubuntu 24.04 with AppArmor userns restrictions enabled. Before fix: browser_navigate fails with sandbox error. After fix: succeeds and returns snapshot.

Fixes silent --no-sandbox bypass failure on AppArmor-restricted Linux.

The auto-detection logic for --no-sandbox injection was setting the
wrong environment variable. agent-browser v0.26.0 reads
AGENT_BROWSER_ARGS (comma-separated), not AGENT_BROWSER_CHROME_FLAGS.

When running on systems with AppArmor unprivileged userns restrictions
(e.g. Ubuntu 23.10+), this caused Chromium to crash with
"No usable sandbox!" even though the code detected the restriction
correctly.

- Rename env var: AGENT_BROWSER_CHROME_FLAGS → AGENT_BROWSER_ARGS
- Adjust flag format: space-separated → comma-separated
- Add comment clarifying the agent-browser env var contract

Fixes silent --no-sandbox bypass failure on AppArmor-restricted Linux.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) duplicate This issue or pull request already exists labels May 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #25988 (merged) which already landed the same AGENT_BROWSER_CHROME_FLAGS → AGENT_BROWSER_ARGS rename fix. The fix is on main — AGENT_BROWSER_ARGS is already set correctly in browser_tool.py.

@tsella

tsella commented May 23, 2026

Copy link
Copy Markdown
Author

Superseded by upstream fix in 0.14.0 — the upstream now handles --no-sandbox and --disable-dev-shm-usage via AGENT_BROWSER_ARGS/AGENT_BROWSER_CHROME_FLAGS properly. Closing.

@tsella tsella closed this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists 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.

2 participants