Skip to content

fix(install): stop auto-detecting a system browser; always install bundled Chromium - #50852

Merged
teknium1 merged 2 commits into
NousResearch:mainfrom
xxxigm:fix/install-drop-system-browser-fallback
Jun 23, 2026
Merged

fix(install): stop auto-detecting a system browser; always install bundled Chromium#50852
teknium1 merged 2 commits into
NousResearch:mainfrom
xxxigm:fix/install-drop-system-browser-fallback

Conversation

@xxxigm

@xxxigm xxxigm commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Reported in Discord (LikiusInik): "hermes desktop: opening web page failed" — every browser_navigate hangs ~60s and fails.

Root cause (confirmed in https://discord.com/channels/1053877538025386074/1518581111008268389): the installer auto-detects a system browser. On a Snap-based Linux box, find_system_browser runs command -v chromium, which resolves to /snap/bin/chromium. Snap's sandbox blocks agent-browser's control socket under /tmp, so the browser tool times out on first use. The installer also (a) skips the bundled Playwright Chromium download and (b) writes AGENT_BROWSER_EXECUTABLE_PATH=/snap/bin/chromium into ~/.hermes/.env. Re-running the installer never recovers — the Snap binary is still detected and the download stays skipped, which is exactly why commenting the .env line + re-running did nothing for the reporter.

Fix

Drop the system-browser fallback entirely. Every install now uses the bundled Playwright Chromium, so the browser tool behaves identically across hosts.

  • find_system_browser() (install.sh) and Find-SystemBrowser (install.ps1) now honor only an explicit, user-set AGENT_BROWSER_EXECUTABLE_PATH. No PATH scan, no macOS .app scan, no Windows well-known-path scan.
  • A user who deliberately sets AGENT_BROWSER_EXECUTABLE_PATH still skips the bundled download (explicit override, not a fallback).
  • Updated the now-misleading log/.env wording accordingly.

Tests

tests/test_install_sh_browser_install.py updated to assert the new behavior:

  • test_install_script_does_not_autodetect_system_browser_on_path — the PATH-scan command list is gone; download is only skipped for an explicit override.
  • test_install_script_honors_explicit_browser_overridefind_system_browser consults only the override env var.
6 passed in 0.17s

Affected user workaround (pre-merge)

sed -i '/^AGENT_BROWSER_EXECUTABLE_PATH=/d' ~/.hermes/.env
cd ~/.hermes/hermes-agent && npx playwright install chromium

Infographic

PR #50852 infographic

@xxxigm
xxxigm force-pushed the fix/install-drop-system-browser-fallback branch 2 times, most recently from 7ffa5bd to 6f3cf66 Compare June 22, 2026 14:38
xxxigm added 2 commits June 22, 2026 21:45
…verride

The installer scanned PATH/well-known locations for a Chrome/Chromium binary
and, when found, skipped the bundled Playwright Chromium download and wrote that
path into ~/.hermes/.env as AGENT_BROWSER_EXECUTABLE_PATH. On Snap-based systems
`command -v chromium` resolves to /snap/bin/chromium, whose sandbox blocks
agent-browser's control socket under /tmp -- so every browser_navigate hung
until the 60s timeout fired ("opening web page failed").

Drop the system-browser fallback entirely (per maintainer direction):
find_system_browser()/Find-SystemBrowser now honor ONLY an explicit, user-set
AGENT_BROWSER_EXECUTABLE_PATH override -- no PATH scan, no well-known-path scan.
A /snap/* path is rejected even when set explicitly, since its confinement is
the bug. Applied to both install.sh (Linux/macOS) and install.ps1 (Windows).

Crucially, also auto-repair already-affected installs: the bad snap path
persists in .env and is read directly by the runtime, and the installer skips
re-config when AGENT_BROWSER_EXECUTABLE_PATH is already set ("already
configured"), so a plain reinstall/update never recovered an existing user. New
strip_snap_browser_override() removes a snap-pointing AGENT_BROWSER_EXECUTABLE_PATH
(and its auto-written comment) from .env on every install/update, run from both
browser-setup paths (install_node_deps and ensure_browser), so updating is
enough to recover. A deliberately-set non-snap override is left untouched.

docker/stage2-hook.sh is intentionally untouched: it discovers the bundled
Playwright Chromium, not a system browser.
…epair

Replace the old "skips download when a system browser exists" assertions with
tests for the new behavior:
- no PATH scan for browser command names, and the "use the system browser" path
  is gone;
- find_system_browser consults only an explicit AGENT_BROWSER_EXECUTABLE_PATH
  override (which still skips the bundled download);
- strip_snap_browser_override runs on both install paths and a /snap/* path is
  rejected, so already-affected installs auto-recover on update.
@xxxigm
xxxigm force-pushed the fix/install-drop-system-browser-fallback branch from 6f3cf66 to a7d3c08 Compare June 22, 2026 14:46
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard tool/browser Browser automation (CDP, Playwright) labels Jun 22, 2026
@xxxigm
xxxigm marked this pull request as draft June 22, 2026 14:56
@xxxigm
xxxigm marked this pull request as ready for review June 22, 2026 14:57
@teknium1
teknium1 merged commit f32be44 into NousResearch:main Jun 23, 2026
35 checks passed
pnascimento9596 added a commit to pnascimento9596/hermes-agent that referenced this pull request Aug 5, 2026
…aths source cleanly

configure_browser_env_from_system_browser writes the
browser override as AGENT_BROWSER_EXECUTABLE_PATH=$browser_path
with no surrounding quotes. Post-NousResearch#50852 this path is
opt-in only: it runs when the user has exported
AGENT_BROWSER_EXECUTABLE_PATH explicitly. When that
override contains a space (macOS
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome,
Windows C:\Program Files\...), the written line is
invalid under POSIX shell source: the shell parses the
first word after the space as a command, emits
"no such file or directory", and leaves the var empty.
install.ps1 has the same bug at both writer sites.

The Hermes runtime is unaffected (it loads .env via
python-dotenv, which parses the unquoted value), but
anyone who sources ~/.hermes/.env from a shell —
which override users are especially likely to do —
gets a stderr error and a silently-empty var.

Fix: wrap the value in double quotes at all four
writer sites (install.sh + install.ps1). Generalize
the strip_snap_browser_override regexes from
'^AGENT_BROWSER_EXECUTABLE_PATH=/snap/' to
'="?/snap/' so the Snap-stripper still fires on the
new quoted form — without this the migration silently
no-ops on a quoted snap path, a regression the naive
one-line fix would introduce. Update the test
assertion pinning the old regex and add behavioral
tests that write a spaced path and re-source the .env
under both bash and POSIX sh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard 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