fix: handle empty IPC responses#342
Open
honor2030 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConnectionErrorwhen an IPC peer closes before sending any response, instead of treating EOF as{}.connection_statusreplies inbrowser_connections()so stale endpoints do not crash diagnostics or count as active browsers.Test Plan
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 -qfailed before the fix.3 passed).uv run --with pytest python -m pytest tests -q(97 passed).uv run python -m compileall src tests.uv pip check --python .venv/bin/python.uv run --with pip-audit python -m pip_audit(no known vulnerabilities; local package skipped because it is not on PyPI).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 insrc/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.
ipc.request: raiseConnectionErrorwhen the peer closes without sending a response (no more{}on EOF).browser_connections(): skip non-dict or"error"connection_statusreplies so stale endpoints don’t appear active.Written for commit 08815e6. Summary will update on new commits.