Skip to content

fix(browse): add --disable-dev-shm-usage and --no-sandbox to Chromium launch args#1374

Closed
baofuen wants to merge 1 commit intogarrytan:mainfrom
baofuen:main
Closed

fix(browse): add --disable-dev-shm-usage and --no-sandbox to Chromium launch args#1374
baofuen wants to merge 1 commit intogarrytan:mainfrom
baofuen:main

Conversation

@baofuen
Copy link
Copy Markdown

@baofuen baofuen commented May 8, 2026

Problem

WSL2 and Docker containers often lack /dev/shm (shared memory) and unprivileged user namespaces. Chromium requires both to function correctly in multi-step browsing (chain commands, goto→js, goto→screenshot).

Without these flags:

  • Individual browse commands work (goto, status)
  • Multi-step operations hang/timeout (chain, goto→js, goto→screenshot)

Root cause: Chromium's CDP communication stalls when /dev/shm is insufficient, causing page.evaluate() and other IPC operations to hang indefinitely. The daemon starts and accepts connections, but any JS evaluation after navigation to a local SPA page hangs.

Fix

Add --disable-dev-shm-usage and --no-sandbox as default arguments in both launch() and launchCDP() methods, instead of conditionally adding --no-sandbox only in CI/CONTAINER environments.

Changes in browse/src/browser-manager.ts:

  1. launch() method: inject both flags into launchArgs at initialization
  2. launchCDP() method: same flags added to the CDP launch args array

Verification

Tested on WSL2 (Ubuntu 22.04) with a local React SPA at localhost:18081:

Before fix:

$B goto localhost:18081 → ✓ 200 
$B js "document.title" → ✗ HANG
$B chain → ✗ 30s timeout

After fix:

echo 'goto http://localhost:18081 | status | js "document.title" | console --errors | network' | $B chain
→ [goto] Navigated to http://localhost:18081 (200)
→ [status] Status: healthy, URL: http://localhost:18081/
→ [js] MemoryCenter - AI Brain Console
→ [console] (errors captured correctly)
→ [network] 5 static assets, all 200

Public URLs (example.com) were not affected but continue to work correctly after the change.


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

… launch args

WSL2 and Docker containers often lack /dev/shm (shared memory) and
unprivileged user namespaces. Chromium requires both to function
correctly in multi-step browsing (chain commands, goto→js, goto→screenshot).

Without these flags:
- Individual browse commands work (goto, status)
- Multi-step operations hang/timeout (chain, goto→js, goto→screenshot)

Root cause: Chromium's CDP communication stalls when /dev/shm is
insufficient, causing page.evaluate() and other IPC operations to hang.

Fix: Add --disable-dev-shm-usage and --no-sandbox as default arguments
in both launch() and launchCDP() methods, instead of conditionally adding
--no-sandbox only in CI/CONTAINER environments.

Verified: chain command with goto→status→js→console→network works on
localhost SPA in WSL2 where it previously hung.
@garrytan
Copy link
Copy Markdown
Owner

garrytan commented May 9, 2026

Closing in favor of #1366 (by @furkankoykiran) which scopes --no-sandbox to root users on Linux/WSL2 only. Unconditional disable of the Chromium sandbox is too broad — it silently downgrades macOS desktop browsers too. Merged as part of the v1.30.0.0 fix wave (#1391). Thanks for catching the underlying issue!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants