hermes - ✅(Solved) Fix [Bug] Browser tool: subprocess inherits proxy env vars causing ERR_EMPTY_RESPONSE [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#14372Fetched 2026-04-24 06:17:34
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Error Message

  1. Observe: net::ERR_EMPTY_RESPONSE error, browser navigation fails

Root Cause

In tools/browser_tool.py, _run_browser_command() builds browser_env by copying os.environ:

browser_env = {**os.environ}

This copies all proxy environment variables into the subprocess environment. The browser daemon then routes CDP traffic through the proxy, which is not designed for this traffic pattern.

Fix Action

Fixed

PR fix notes

PR #14393: fix(browser): strip proxy env from agent-browser subprocess

Description (problem / solution / changelog)

Fixes #14372

Root cause

_run_browser_command() copied the full parent os.environ into the local agent-browser subprocess. When users run Hermes behind Clash/V2Ray/corporate proxy settings, proxy variables such as HTTP_PROXY, https_proxy, or ALL_PROXY can be inherited by the browser daemon and interfere with its local browser/CDP traffic, surfacing as ERR_EMPTY_RESPONSE.

Fix

  • Strip proxy-related environment variables from the local browser subprocess environment before spawning agent-browser.
  • Match proxy keys case-insensitively so mixed-case shell exports are also removed.
  • Preserve unrelated browser/runtime environment such as HERMES_HOME, PATH, and cloud browser credentials.

Relationship to #6030

#6030 addresses a broader subprocess-environment hardening root cause, but it is currently dirty and also touches RL training. This PR is intentionally narrower: it only salvages the browser proxy failure reported in #14372 with a focused regression test.

Tests

  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_browser_homebrew_paths.py::TestRunBrowserCommandPathConstruction::test_subprocess_env_strips_proxy_vars -q --tb=short
  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_browser_homebrew_paths.py::TestRunBrowserCommandPathConstruction::test_subprocess_path_includes_sane_path_homebrew tests/tools/test_browser_homebrew_paths.py::TestRunBrowserCommandPathConstruction::test_subprocess_path_includes_homebrew_node_dirs -q --tb=short
  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_browser_homebrew_paths.py -q --tb=short
  • /Users/stephenyu/Documents/hermes-agent/.venv/bin/python -m pytest tests/tools/test_browser_hardening.py tests/tools/test_browser_ssrf_local.py -q --tb=short
  • git diff --check

Changed files

  • tests/tools/test_browser_homebrew_paths.py (modified, +53/-0)
  • tools/browser_tool.py (modified, +14/-0)

Code Example

browser_env = {**os.environ}

---

# Strip proxy env vars so the browser subprocess can make direct connections.
# These are inherited from the parent process and cause ERR_EMPTY_RESPONSE
# when the proxy is unavailable or misconfigured for the browser's traffic.
for _proxy_key in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY",
                   "all_proxy", "ALL_PROXY", "no_proxy", "NO_PROXY"):
    browser_env.pop(_proxy_key, None)
RAW_BUFFERClick to expand / collapse

Bug Description

When Hermes Agent runs on a machine with HTTP(S) proxy environment variables set (e.g. Clash TUN mode, corporate proxy), the browser subprocess spawned by the browser tool inherits these proxy settings via os.environ copy.

The browser subprocess (via agent-browser daemon) then attempts to route its CDP connections through the proxy, which either:

  1. Causes net::ERR_EMPTY_RESPONSE when the proxy is unavailable/misconfigured for browser traffic
  2. Fails to connect entirely

This affects any user behind a proxy — particularly common on WSL2 with Clash/V2Ray.

Environment

  • OS: WSL2 Ubuntu on Windows 11
  • Proxy: Clash TUN mode (127.0.0.1:7890), injected via env vars
  • Hermes: v0.10.0 (latest main branch)
  • Python: 3.10+

Steps to Reproduce

  1. Set http_proxy=https://127.0.0.1:7890 (and HTTP_PROXY, https_proxy, etc.)
  2. Run hermes-agent with browser tools enabled
  3. Issue a command that uses browser_navigate: 请访问 https://example.com
  4. Observe: net::ERR_EMPTY_RESPONSE error, browser navigation fails

Root Cause

In tools/browser_tool.py, _run_browser_command() builds browser_env by copying os.environ:

browser_env = {**os.environ}

This copies all proxy environment variables into the subprocess environment. The browser daemon then routes CDP traffic through the proxy, which is not designed for this traffic pattern.

Suggested Fix

Strip proxy environment variables before spawning the browser subprocess, similar to what was done for the Codex client in PR #11414:

# Strip proxy env vars so the browser subprocess can make direct connections.
# These are inherited from the parent process and cause ERR_EMPTY_RESPONSE
# when the proxy is unavailable or misconfigured for the browser's traffic.
for _proxy_key in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY",
                   "all_proxy", "ALL_PROXY", "no_proxy", "NO_PROXY"):
    browser_env.pop(_proxy_key, None)

Related Issues

  • #11609: WSL + proxy — API timeout (similar root cause, different code path)
  • #11414: Codex client proxy handling fix ( httpx transport, not browser subprocess)

extent analysis

TL;DR

To fix the issue, strip proxy environment variables from the browser subprocess environment in tools/browser_tool.py to prevent it from routing CDP connections through the proxy.

Guidance

  • Identify the lines in tools/browser_tool.py where browser_env is constructed and modify it to exclude proxy environment variables.
  • Verify that the fix works by running the steps to reproduce with the modified code and checking for the absence of net::ERR_EMPTY_RESPONSE errors.
  • Consider reviewing related issues (#11609 and #11414) for similar problems and solutions in other parts of the codebase.
  • Test the fix with different proxy configurations to ensure it works in various scenarios.

Example

# Strip proxy env vars so the browser subprocess can make direct connections.
for _proxy_key in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY",
                   "all_proxy", "ALL_PROXY", "no_proxy", "NO_PROXY"):
    browser_env.pop(_proxy_key, None)

Notes

This fix assumes that the issue is solely caused by the proxy environment variables being inherited by the browser subprocess. If other factors are at play, additional debugging may be necessary.

Recommendation

Apply the suggested fix to strip proxy environment variables from the browser subprocess environment, as it directly addresses the identified root cause and is a targeted solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug] Browser tool: subprocess inherits proxy env vars causing ERR_EMPTY_RESPONSE [1 pull requests, 1 comments, 2 participants]