Skip to content

fix(daemon): bound CDP request waits#372

Open
honor2030 wants to merge 1 commit into
browser-use:mainfrom
honor2030:fix/cdp-send-timeout-370
Open

fix(daemon): bound CDP request waits#372
honor2030 wants to merge 1 commit into
browser-use:mainfrom
honor2030:fix/cdp-send-timeout-370

Conversation

@honor2030
Copy link
Copy Markdown

@honor2030 honor2030 commented May 18, 2026

Summary

  • Bound regular daemon CDP request waits so a stuck Chrome/CDP call returns an error before the helper IPC socket times out.
  • Add a regression test for a hanging Page.navigate path that previously left the helper with only a client-side _ipc.request() timeout.

Refs #370

Why

In #370, the visible symptom is a second navigation timing out in _ipc.py while the daemon later logs conn: Connection lost. I could not reproduce the underlying WebSocket drop on current main, but this hardens the daemon boundary so a stuck CDP send produces a useful Page.navigate timed out after 4.5s response instead of letting the helper hit its 5s socket deadline first.

Test Plan

  • RED: uv run --with pytest --with pillow python -m pytest tests/unit/test_daemon.py::test_regular_cdp_calls_timeout_before_client_socket_deadline -q failed before the fix with an outer TimeoutError.
  • GREEN: uv run --with pytest --with pillow python -m pytest tests/unit/test_daemon.py::test_regular_cdp_calls_timeout_before_client_socket_deadline -q1 passed.
  • GREEN: uv run --with pytest --with pillow python -m pytest tests/unit -q91 passed.
  • GREEN: uv run python -m compileall -q src tests → passed.
  • GREEN: git diff --check → passed.
  • Dynamic probe: BU_NAME=oss370pr2 uv run browser-harness with new_tab('https://example.com') followed by new_tab('https://httpbin.org/ip') → both navigations returned page_info() successfully on my local Chrome.

Notes

This is a scoped mitigation/diagnostic hardening PR, not a claim that the root WebSocket drop reported in #370 is fully fixed. If maintainers prefer a different timeout budget or want this limited to navigation/session-bound calls, I can adjust.


Summary by cubic

Bound CDP request waits in the daemon to 4.5s so stalled Chrome/CDP calls return a clear error before the helper’s 5s IPC socket deadline. Mitigates the timeout symptom in #370 by failing fast with messages like "Page.navigate timed out after 4.5s".

  • Bug Fixes
    • Added CDP_CALL_TIMEOUT = 4.5 and a send_cdp() wrapper that uses asyncio.wait_for and returns a concise timeout error.
    • Used the wrapper for normal sends and after session re-attach.
    • Added a regression test ensuring the daemon surfaces the timeout before the client IPC socket deadline.

Written for commit 1689057. Summary will update on new commits. Review in cubic

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 2 files

Re-trigger cubic

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