Skip to content

fix(browser): pass sandbox flags via AGENT_BROWSER_ARGS - #23517

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/23496-browser-sandbox-env
Closed

fix(browser): pass sandbox flags via AGENT_BROWSER_ARGS#23517
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/23496-browser-sandbox-env

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the sandbox-bypass env handoff in tools/browser_tool.py so local browser launches pass Chromium flags through the env var that agent-browser actually reads.

Today Hermes detects when --no-sandbox --disable-dev-shm-usage is needed, but writes those flags to AGENT_BROWSER_CHROME_FLAGS. agent-browser expects AGENT_BROWSER_ARGS, so the bypass never reaches Chrome and headless launches still fail on root/AppArmor-restricted hosts.

Related Issue

Fixes #23496

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • switch the sandbox bypass env injection from AGENT_BROWSER_CHROME_FLAGS to AGENT_BROWSER_ARGS in tools/browser_tool.py
  • add regression coverage in tests/tools/test_browser_homebrew_paths.py for both root and AppArmor-restricted launches
  • assert we no longer emit the stale AGENT_BROWSER_CHROME_FLAGS env var in the launch path

How to Test

  1. Run uv run --frozen pytest -q -o addopts='' tests/tools/test_browser_homebrew_paths.py
  2. Confirm the new tests cover root sandbox bypass and AppArmor userns restriction detection
  3. Optionally reproduce on a Linux/AppArmor host and verify browser commands now launch with AGENT_BROWSER_ARGS=--no-sandbox --disable-dev-shm-usage

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • uv run --frozen pytest -q -o addopts='' tests/tools/test_browser_homebrew_paths.py -> 24 passed
  • uv run --frozen ruff check tools/browser_tool.py tests/tools/test_browser_homebrew_paths.py -> passed

@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing PRs for #23496: #23532, #21659, #20014, #22582. All fix the same AGENT_BROWSER_CHROME_FLAGS → AGENT_BROWSER_ARGS rename.

@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 11, 2026
@shan-dot-ee

shan-dot-ee commented May 11, 2026

Copy link
Copy Markdown

See note from original issue #23496 :

  • A simpler in-place rename of AGENT_BROWSER_CHROME_FLAGS to AGENT_BROWSER_ARGS within the current block was not sufficient to restore launches in our testing; we'd encourage maintainers to reproduce on an Ubuntu 24.04 AppArmor host before considering a minimal rename as the fix.

@teknium1

Copy link
Copy Markdown
Contributor

Automated hermes-sweeper review: this browser sandbox env-var fix is already implemented on main.

Evidence:

@teknium1 teknium1 closed this Jun 11, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 11, 2026
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 sweeper:implemented-on-main Sweeper: behavior already present on current main tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

4 participants