Guard direct CDP helpers during reconnect by euyua9 · Pull Request #4722 · browser-use/browser-use · GitHub
Skip to content

Guard direct CDP helpers during reconnect#4722

Open
euyua9 wants to merge 1 commit intobrowser-use:mainfrom
euyua9:sysa/browser-use-cdp-guard-20260422
Open

Guard direct CDP helpers during reconnect#4722
euyua9 wants to merge 1 commit intobrowser-use:mainfrom
euyua9:sysa/browser-use-cdp-guard-20260422

Conversation

@euyua9
Copy link
Copy Markdown

@euyua9 euyua9 commented Apr 21, 2026

Summary

  • wait for in-flight CDP reconnects before direct storage/cookie helper commands run
  • fail fast with a clear ConnectionError when CDP is still unavailable
  • add focused regression tests for reconnect success, timeout, and export_storage_state behavior

Testing

  • python -m pytest tests/ci/browser/test_session_start.py -k "cdp_command or export_storage_state_waits_for_reconnect"

Summary by cubic

Guarded direct CDP cookie/storage helpers to wait for in‑flight reconnects and fail fast when CDP is unavailable. This prevents race conditions during reconnect and surfaces clear errors.

  • Bug Fixes
    • Added _ensure_cdp_ready_for_command and applied it to export_storage_state, _cdp_get_cookies, _cdp_set_cookies, and _cdp_clear_cookies with timeout and clear ConnectionError messages.
    • Added focused tests for reconnect success, timeout, fast‑fail when disconnected, and export_storage_state waiting before fetching cookies.

Written for commit 4fa600a. 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 2 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