Skip to content

feat(browser): connect CDP to the real user profile - #2195

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/browser-default-cdp-profile
Aug 10, 2026
Merged

feat(browser): connect CDP to the real user profile#2195
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/browser-default-cdp-profile

Conversation

@bobleer

@bobleer bobleer commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

What

Lets browser control attach to the Chrome/Edge the user already has open — existing tabs, existing logins — instead of launching an empty managed profile. The browser owns the consent: a persistent switch on its own settings page, plus a per-connection approval dialog.

Two commits:

  1. feat(browser): connect CDP to real user profiles — discover the browser-level endpoint from DevToolsActivePort in the browser's normal user-data dir, connect over that WebSocket, and expose an Enable default CDP action in Settings.
  2. fix(browser): open the real remote debugging page for default CDP — the setup flow above never actually worked; see below.

The bug in commit 1

The setup step spawned the browser with the settings URL on the command line:

/Applications/Google Chrome.app/Contents/MacOS/Google Chrome  chrome://inspect/#remote-debugging

Chromium drops chrome:// URLs handed to it on the command line and silently substitutes chrome://newtab/. Reproduced on Chrome 151 with chrome://version, chrome://settings and chrome://inspect — all three land on the New Tab Page. So the browser popped open on a blank tab, there was no switch to tick, and the 60s setup wait always timed out with "the switch was not detected".

Fix

  • macOS — route the URL through the browser's own AppleScript open location handler, which is not subject to that filter. Verified opening chrome://inspect/#remote-debugging correctly.
  • Windows / Linux — no equivalent entry point. They no longer open a throwaway tab that pretends to have worked; they start the browser only if it is not running and hand the URL back to the user, reported as a distinct requires_manual_user_profile_setup status that carries setupUrl so the UI can show it.

Also

chrome://inspect is not localized — it stays English even under --lang=zh-CN. The prompts said "勾选『允许远程调试』", which appears nowhere on that page; they now quote the real label, "Allow remote debugging for this browser instance".

And the browser-control settings copy leaked internal vocabulary ("guarded CDP", "real user profile", "empty profile"). Rewritten in plain language across en-US / zh-CN / zh-TW.

Verified

On Chrome 151, in throwaway profiles:

  • devtools.remote_debugging.user-enabled: true in Local State → server on 9222 + DevToolsActivePort written to the user-data dir. The detection path in commit 1 is correct.
  • In that mode the HTTP endpoints (/json/version, /json/list) return 404; only the browser WebSocket from DevToolsActivePort works — which is what the client uses.
  • The switch exists and is visible by default: #remote-debugging-enabled, "Allow remote debugging for this browser instance".

Build/tests: cargo check -p bitfun-desktop -p bitfun-core -p bitfun-services-integrations, cargo test -p bitfun-services-integrations --features browser-control (9 passed), tsc --noEmit (0 errors). Setup flow confirmed working end to end on macOS by the reporter.

Chromium drops chrome:// URLs handed to it on the command line and
silently substitutes the New Tab Page, so spawning the browser with
chrome://inspect/#remote-debugging never reached the settings page: the
browser popped open on a blank tab, there was no switch to tick, and the
setup wait always timed out.

macOS now routes the URL through the browser's own AppleScript
`open location` handler, which is not subject to that filter. Other
platforms have no equivalent entry point, so they stop opening a
throwaway tab and hand the URL to the user instead, reported as a
distinct `requires_manual_user_profile_setup` status carrying the URL.

The chrome://inspect page is English-only even under a localized
browser, so the prompts now quote the switch by its real label,
"Allow remote debugging for this browser instance".

Also rewrite the browser control copy that leaked internal vocabulary
("guarded CDP", "real user profile", "empty profile") into plain
language describing what the setting does.
@bobleer
bobleer merged commit a4fc4c2 into GCWing:main Aug 10, 2026
4 of 7 checks passed
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