Skip to content

fix(browser): strip PYTHONPATH/PYTHONHOME from browser-use CLI subprocess env (salvage #83471) - #86371

Merged
teknium1 merged 1 commit into
mainfrom
fix/browser-use-strip-pythonpath
Aug 14, 2026
Merged

fix(browser): strip PYTHONPATH/PYTHONHOME from browser-use CLI subprocess env (salvage #83471)#86371
teknium1 merged 1 commit into
mainfrom
fix/browser-use-strip-pythonpath

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

browser_exec no longer crashes with pydantic_core ABI mismatch / ModuleNotFoundError when the parent process carries PYTHONPATH/PYTHONHOME — the browser-use CLI subprocess env now strips both, so the CLI's own interpreter resolves its own packages.

Root cause: the CLI runs under its own Python (uv tool / uvx), but a child interpreter honors inherited PYTHONPATH/PYTHONHOME ahead of its own site-packages — importing C-extensions built for Hermes's venv interpreter. Hit the desktop backend on py3.14 and any shell exporting PYTHONPATH.

Fixes #83427, #84841, #86006, #86104.

Salvage of #83471 by @n1majne3 (earliest of two independent fixes; #84022 by @jklance16 covered PYTHONPATH only) — the contributor branch bundled unrelated desktop commits via a merge, so the browser hunk was surgically reapplied with authorship preserved.

Changes

Validation

Before After
desktop backend, py3.14 pydantic_core ABI crash clean run
shell exports PYTHONPATH ModuleNotFoundError clean run
tests/tools/test_browser_use_cli.py 85/85 passing

Infographic

Clean room for the browser engine

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 83a96afb-dd0a-43f4-a54a-1eb23567b4cf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on c1ed96f — fix(browser): strip PYTHONPATH/PYTHONHOME from browser-use C

⚠️ Warnings

CI timings · View report · View job

Wall time 7m38s vs 5m22s (+42.2%). 12 job(s) slower, 10 faster, 2 unchanged.

  • Python tests / Run tests slice 3/12: +33.0s
  • OS-specific tests / macOS-only tests: +21.0s
  • Python tests / Run tests slice 12/12: +20.0s
  • Python tests / Run tests slice 4/12: +16.0s
  • Python tests / Run tests slice 11/12: -16.0s

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@alt-glitch alt-glitch added type/bug Something isn't working tool/browser Browser automation (CDP, Playwright) P2 Medium — degraded but workaround exists labels Aug 14, 2026
…cess env

The browser-use CLI runs under its own Python (uv tool / uvx), which
can differ from Hermes's venv interpreter. PYTHONPATH/PYTHONHOME
inherited from the agent process point at Hermes's venv
site-packages, and a child interpreter honors them ahead of its own —
so the CLI imported compiled C-extensions (pydantic_core) built for
the wrong interpreter and crashed with ABI mismatch /
ModuleNotFoundError (issues 83427, 84841, 86006, 86104; hits the
desktop backend on py3.14 and any shell exporting PYTHONPATH).

Strip both vars in _base_subprocess_env() — the CLI manages its own
environment and never needs Hermes's import path.

Salvaged from PR 83471 by Benjamin (@n1majne3), the earliest of two
independent fixes (also PR 84022 by @jklance16, PYTHONPATH-only);
regression test covers both vars and preserves unrelated env.
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 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.

browser_exec crashes: pydantic_core ModuleNotFoundError when PYTHONPATH points at Hermes venv (desktop app)

3 participants