Skip to content

fix(daemon): detect windowless Chrome before handshake - #659

Closed
kyletser wants to merge 2 commits into
browser-use:mainfrom
kyletser:fix/windowless-chrome-diagnostic
Closed

kyletser wants to merge 2 commits into
browser-use:mainfrom
kyletser:fix/windowless-chrome-diagnostic

Conversation

@kyletser

@kyletser kyletser commented Aug 27, 2026 •

Copy link
Copy Markdown

What

  • Probe the local DevTools /json/list endpoint before starting the browser WebSocket handshake.
  • Fail fast with a chrome-windowless diagnostic when Chrome consistently exposes no page target.
  • Preserve the existing handshake path whenever the probe is unavailable, malformed, non-local, or a page appears during startup.

Why

A local Chrome launched with --no-startup-window cannot render the remote-debugging permission popup. The daemon currently waits for the full 45-second handshake timeout and then tells the user to click a popup that does not exist.

Design

The probe is restricted to loopback ws:// endpoints in local-browser mode. It requires three consecutive empty target lists, spaced 200 ms apart, so a newly launched Chrome can publish its first page target before being classified as windowless. Any ambiguous probe result fails open to the existing handshake behavior.

Verification

  • uv run --python 3.12 --with pytest python -m pytest tests/unit/test_daemon.py -q — 38 passed
  • Full unit suite on Windows — 166 passed; the same 3 pre-existing platform-specific failures seen on the unmodified baseline remain
  • uv run --python 3.12 --with ruff ruff check --select E9,F63,F7,F82 src/browser_harness/daemon.py tests/unit/test_daemon.py
  • uv run --python 3.12 --with build python -m build
  • Red/green and mutation checks cover no-page detection and the startup race

Fixes #554


Summary by cubic

Fixes the 45-second handshake timeout caused by Chrome launched with --no-startup-window, which cannot show the remote-debugging permission popup. The daemon now probes the local DevTools /json/list endpoint before the handshake and fails fast with a chrome-windowless diagnostic when Chrome consistently exposes no page target.

  • The probe only runs on loopback ws:// endpoints and falls back to the existing handshake for any ambiguous or malformed result.
  • Requires three consecutive probe responses with no page target, 200 ms apart, so a freshly launched Chrome can publish its first page.

Fixes #554.

Written for commit f95d474. Summary will update on new commits.

Review in cubic

Copilot AI lite review requested due to automatic review settings August 27, 2026 12:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/browser_harness/daemon.py Resolved
Comment thread src/browser_harness/daemon.py Resolved
Comment thread src/browser_harness/daemon.py Resolved
@kyletser

kyletser commented Oct 3, 2026

Copy link
Copy Markdown
Author

Closing this PR: there has been no maintainer response for over a month, so I'm keeping the contribution queue tidy. The change remains on the fork branch — feel free to ask me to reopen it if you'd like to take it up.

@kyletser kyletser closed this Oct 3, 2026
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.

Cold daemon against a windowless Chrome hangs 45s, then misreports as an unclicked "Allow remote debugging?" popup

3 participants