Skip to content

fix(cli): check /browser status against configured CDP host#8257

Open
liu-collab wants to merge 2 commits intoNousResearch:mainfrom
liu-collab:fix/browser-status-remote-cdp-host
Open

fix(cli): check /browser status against configured CDP host#8257
liu-collab wants to merge 2 commits intoNousResearch:mainfrom
liu-collab:fix/browser-status-remote-cdp-host

Conversation

@liu-collab
Copy link
Copy Markdown

@liu-collab liu-collab commented Apr 12, 2026

What does this PR do?

This fixes /browser status and the /browser connect reachability check when Hermes is connected to a non-local CDP endpoint.

Previously, the CLI always checked 127.0.0.1:<port> even when BROWSER_CDP_URL or /browser connect pointed at a different host, such as a Windows host IP from WSL2. That caused false not reachable warnings even when the configured remote CDP endpoint was the correct one.

This change makes Hermes parse the configured CDP URL and check the actual host/port from that endpoint instead of hardcoding localhost.

Related Issue

No existing issue or PR found for this specific /browser status remote-host false-negative bug.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • cli.py
    • Added _get_cdp_socket_target() to extract host/port from configured CDP URLs
    • Added _is_cdp_endpoint_reachable() so reachability checks use the configured endpoint host instead of always probing 127.0.0.1
    • Updated /browser connect and /browser status to use the configured CDP host/port
  • tests/cli/test_cli_browser_connect.py
    • Added coverage for remote-host CDP URL parsing
    • Added coverage that /browser status checks the configured endpoint value
    • Uses documentation-safe example IPs instead of environment-specific private addresses

How to Test

  1. Start Hermes from WSL2 and connect browser tools to a Windows-hosted CDP endpoint such as:
    /browser connect http://<windows-host-ip>:9222
  2. Run /browser status
  3. Confirm Hermes reports reachability based on the configured host instead of incorrectly probing 127.0.0.1:9222

Static validation run in this environment:

python3 -m py_compile cli.py tests/cli/test_cli_browser_connect.py

I could not run the targeted pytest file in this environment because pytest is not installed in the local WSL runtime used for validation.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 10 22H2 + WSL2 Ubuntu

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Before fix, /browser status could show:

Browser: connected to live Chrome via CDP
Endpoint: http://<windows-host-ip>:9222
Status: not reachable

because the code probed 127.0.0.1:9222 instead of the configured endpoint host.

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.

1 participant