Skip to content

fix(sandbox): pass OPENCLAW_BROWSER_NO_SANDBOX=1 to browser container#29879

Merged
obviyus merged 1 commit intoopenclaw:mainfrom
Lukavyi:fix-sandbox-browser-no-sandbox
Feb 28, 2026
Merged

fix(sandbox): pass OPENCLAW_BROWSER_NO_SANDBOX=1 to browser container#29879
obviyus merged 1 commit intoopenclaw:mainfrom
Lukavyi:fix-sandbox-browser-no-sandbox

Conversation

@Lukavyi
Copy link
Copy Markdown
Contributor

@Lukavyi Lukavyi commented Feb 28, 2026

Summary

Sandbox browser Chromium fails to start in Docker because the setuid/namespace sandbox requires privileges that Docker containers do not grant by default (PID namespace creation fails with EPERM).

The entrypoint (sandbox-browser-entrypoint.sh) already supports the OPENCLAW_BROWSER_NO_SANDBOX env var to pass --no-sandbox to Chromium, but ensureSandboxBrowser() in browser.ts never passed it to the container.

Changes

  • Pass OPENCLAW_BROWSER_NO_SANDBOX=1 env var when creating the sandbox browser Docker container

Why --no-sandbox is safe here

The Docker container itself provides process isolation. This is standard practice for headless Chromium in Docker — Playwright, Puppeteer, and Selenium all use --no-sandbox in containerized environments.

Testing

  1. Build sandbox browser image: bash scripts/sandbox-browser-setup.sh
  2. Remove old browser containers: docker rm -f $(docker ps -aq --filter name=openclaw-sbx-browser)
  3. Use browser tool from a sandboxed agent — Chromium now starts successfully and CDP becomes reachable

Before fix: No usable sandbox! error, container exits with code 1, CDP never reachable
After fix: Chromium starts, CDP reachable, browser tool works

Fixes #28870

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 720c68e683

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Chromium's setuid/namespace sandbox cannot work inside Docker containers
// (PID namespace creation requires privileges Docker does not grant by default).
// The container itself provides isolation, so --no-sandbox is safe here.
args.push("-e", "OPENCLAW_BROWSER_NO_SANDBOX=1");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bump browser config hash when forcing no-sandbox

Adding OPENCLAW_BROWSER_NO_SANDBOX=1 only affects newly created containers, but ensureSandboxBrowser reuses existing containers unless the computed config hash changes; this commit neither adds the new env flag to the hash input nor bumps SANDBOX_BROWSER_SECURITY_HASH_EPOCH, so upgraded installs with an existing openclaw-sbx-browser-* container will keep the old env and continue failing to start Chromium until a manual recreate is run.

Useful? React with 👍 / 👎.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 28, 2026

Greptile Summary

Fixes Chromium startup failure in Docker by passing OPENCLAW_BROWSER_NO_SANDBOX=1 to the sandbox browser container. The entrypoint script (sandbox-browser-entrypoint.sh) already supports this environment variable (added in a previous security update), but ensureSandboxBrowser() was never passing it during container creation, causing the browser to fail with "No usable sandbox!" error.

  • Added single environment variable to Docker container creation arguments
  • Change is minimal, well-commented, and aligns with existing security design
  • Uses the opt-in mechanism that was already built into the entrypoint script

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Single-line fix that correctly addresses a critical bug. The entrypoint script already has the logic to handle this environment variable, and the change simply passes it during container creation. Well-tested and documented.
  • No files require special attention

Last reviewed commit: 720c68e

@obviyus obviyus self-assigned this Feb 28, 2026
@Lukavyi Lukavyi force-pushed the fix-sandbox-browser-no-sandbox branch from 720c68e to c947ac4 Compare February 28, 2026 16:09
@obviyus obviyus force-pushed the fix-sandbox-browser-no-sandbox branch from fa37f06 to 239fe73 Compare February 28, 2026 16:13
@obviyus obviyus merged commit 139271a into openclaw:main Feb 28, 2026
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Feb 28, 2026

Landed via temp rebase onto main.

  • Gate: skipped re-run per maintainer request; relied on prior targeted run pnpm test src/agents/sandbox/browser.create.test.ts
  • Land commit: 239fe73
  • Merge commit: PLACEHOLDER_MERGE_SHA

Thanks @Lukavyi!

@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Feb 28, 2026

Correction: merge SHA for land report is 139271ad5a66214c3ebb794c50e99e4a181b541c.

vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Feb 28, 2026
* main: (31 commits)
  fix(browser): resolve correct targetId in navigate response after renderer swap (openclaw#25326)
  fix: sed escaping and UID mismatch in Podman Quadlet setup (openclaw#26414)
  fix(cron): pass heartbeat target=last for main-session cron jobs (openclaw#28508) (openclaw#28583)
  fix(cron): disable messaging tool when delivery.mode is none (openclaw#21808) (openclaw#21896)
  fix: clear delivery routing state when creating isolated cron sessions (openclaw#27778)
  fix(cron): avoid marking queued announce paths as delivered (openclaw#29716)
  fix(cron): enable completion direct send for text-only announce delivery (openclaw#29151)
  fix(cron): force main-target system events onto main session (openclaw#28898)
  fix(cron): condition requireExplicitMessageTarget on resolved delivery (openclaw#28017)
  feat(cron): add --account flag for multi-account delivery routing (openclaw#26284)
  fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs (openclaw#19541)
  fix: sandbox browser docker no-sandbox rollout (openclaw#29879) (thanks @Lukavyi)
  GitHub: add regression bug issue template and routing (openclaw#29864) thanks @Takhoffman
  feat(feishu): add chat info/member tool (openclaw#14674)
  feat(feishu): add markdown tables, positional insert, color_text, and table ops (openclaw#29411)
  feat(feishu): add parent/root inbound context for quote support (openclaw#18529)
  fix: land android onboarding and voice reliability updates (openclaw#29796)
  fix(android-voice): rotate playback token per assistant reply
  fix(android-voice): retry talk config after transient failures
  fix(android-voice): cancel in-flight speech when speaker muted
  ...
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
nsd97 pushed a commit to nsd97/openclaw that referenced this pull request Feb 28, 2026
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
@Lukavyi)

(cherry picked from commit 139271a)

# Conflicts:
#	src/agents/sandbox/browser.create.test.ts
#	src/agents/sandbox/browser.ts
#	src/agents/sandbox/constants.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
@Lukavyi)

# Conflicts:
#	src/agents/sandbox/browser.ts
#	src/agents/sandbox/constants.ts
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
@Lukavyi)

(cherry picked from commit 139271a)

# Conflicts:
#	src/agents/sandbox/browser.create.test.ts
#	src/agents/sandbox/browser.ts
#	src/agents/sandbox/constants.ts
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
@Lukavyi)

# Conflicts:
#	src/agents/sandbox/browser.ts
#	src/agents/sandbox/constants.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Sandbox browser Chromium fails to start in Docker — missing chromium-sandbox package

2 participants