-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Hey y'all, thanks for your work on agent-browser. I'm trying to use --auto-connect to attach to my regular Chrome profile (with all my existing sessions/cookies), and I'm running into an issue with Chrome M144+'s new remote debugging mechanism. Below is Claude Opus 4.6's assessment after a good bit of digging - hopefully it's somewhat useful? :)
Environment
- agent-browser: v0.13.0
- Chrome: 145.0.7632.76 (arm64)
- OS: macOS 15.3 (Darwin 24.6.0, Apple Silicon)
- Remote debugging enabled via:
chrome://inspect/#remote-debuggingUI toggle (not CLI flag)
Problem
--auto-connect fails despite PR #432 being merged:
$ agent-browser --auto-connect screenshot
✗ No running Chrome instance with remote debugging found.
DevToolsActivePort exists and contains valid data:
$ cat ~/Library/Application\ Support/Google/Chrome/DevToolsActivePort
9222
/devtools/browser/1ed17c43-53f8-4ecf-beb8-f3f33e7d5af2
Port 9222 is open (TCP connects), but Chrome M144+'s chrome://inspect server has no HTTP endpoints:
$ curl -v http://127.0.0.1:9222/json/version
< HTTP/1.1 404 Not Found
Explicit --cdp with the full WebSocket URL also fails (likely due to Chrome's user-approval dialog timeout):
$ agent-browser --cdp "ws://127.0.0.1:9222/devtools/browser/1ed17c43-..." screenshot
✗ Failed to connect via CDP to ws://...
Root Cause
Chrome M144+ chrome://inspect/#remote-debugging uses a WebSocket-only server with no HTTP discovery API. Confirmed by Chrome team in ChromeDevTools/chrome-devtools-mcp#772.
The current auto-connect flow in autoConnectViaCDP fails because:
probeDebugPort()calls/json/version→ 404 → returns null- Fallback passes HTTP URL to
connectOverCDP→ Playwright internally calls/json/version/→ 404 → fails - Even with explicit
ws://URL via--cdp, the connection likely times out waiting for Chrome's user-approval dialog
How chrome-devtools-mcp (Google) solves this
Google's chrome-devtools-mcp works because it:
- Reads
DevToolsActivePortdirectly - Constructs
ws://127.0.0.1:${port}${wsPath}without any HTTP probe - Connects via Puppeteer's WebSocket transport directly
- Handles the user-approval dialog delay gracefully
Suggested Fix
- When
DevToolsActivePortexists, construct thews://URL directly from file contents and skipprobeDebugPort()entirely - Pass the
ws://URL toconnectOverCDP(Playwright should handle ws:// URLs without HTTP resolution) - Increase the connection timeout to allow for Chrome's user-approval dialog (user must click "Allow" in Chrome before the connection succeeds)
- Consider adding a log message like "Waiting for approval in Chrome..." so the user knows to click Allow
References
- PR feat: add --auto-connect flag to discover and connect to running Chrome #432 (current auto-connect implementation)
- Chrome blog: Changes to remote debugging switches (Chrome 136+ security change)
- Chrome blog: DevTools MCP auto-connect
- ChromeDevTools/chrome-devtools-mcp#772 ("no HTTP endpoint for this mode")