Skip to content

fix: handle empty IPC responses#342

Open
honor2030 wants to merge 1 commit into
browser-use:mainfrom
honor2030:fix/ipc-request-eof
Open

fix: handle empty IPC responses#342
honor2030 wants to merge 1 commit into
browser-use:mainfrom
honor2030:fix/ipc-request-eof

Conversation

@honor2030
Copy link
Copy Markdown

@honor2030 honor2030 commented May 12, 2026

Summary

  • Raise ConnectionError when an IPC peer closes before sending any response, instead of treating EOF as {}.
  • Skip malformed/non-dict connection_status replies in browser_connections() so stale endpoints do not crash diagnostics or count as active browsers.
  • Add regression coverage for empty EOF and malformed status replies.

Test Plan

  • RED: uv run --with pytest python -m pytest tests/unit/test_ipc.py::test_request_raises_connection_error_when_peer_closes_without_response tests/unit/test_admin.py::test_browser_connections_skips_daemon_that_closes_without_response tests/unit/test_admin.py::test_browser_connections_skips_non_dict_connection_status_response -q failed before the fix.
  • GREEN: same focused command passed (3 passed).
  • GREEN: uv run --with pytest python -m pytest tests -q (97 passed).
  • GREEN: uv run python -m compileall src tests.
  • GREEN: uv pip check --python .venv/bin/python.
  • GREEN: uv run --with pip-audit python -m pip_audit (no known vulnerabilities; local package skipped because it is not on PyPI).
  • GREEN: uv run --with ruff python -m ruff check --select B src/browser_harness/_ipc.py src/browser_harness/admin.py tests/unit/test_admin.py tests/unit/test_ipc.py.

Note: repo-wide ruff --select B . currently reports pre-existing B904 findings in src/browser_harness/daemon.py, outside this PR's diff; the changed-file B check passes.


Summary by cubic

Fixes IPC EOF handling and hardens browser diagnostics to ignore malformed responses. Prevents crashes and stops stale daemons from being counted as active browsers.

  • Bug Fixes
    • ipc.request: raise ConnectionError when the peer closes without sending a response (no more {} on EOF).
    • browser_connections(): skip non-dict or "error" connection_status replies so stale endpoints don’t appear active.
    • Added regression tests for empty EOF and malformed status replies.

Written for commit 08815e6. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

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