fix(daemon): open inspect in the user's running browser, not always Chrome (#425)#471
Open
ahmadalzaro1 wants to merge 1 commit into
Open
fix(daemon): open inspect in the user's running browser, not always Chrome (#425)#471ahmadalzaro1 wants to merge 1 commit into
ahmadalzaro1 wants to merge 1 commit into
Conversation
…hrome Issue browser-use#425. The remote-debugging recovery (_open_chrome_inspect) hardcoded `tell application "Google Chrome"` on macOS, so users whose daily browser is a non-Chrome Chromium (Dia/Arc/Edge/Brave) had Google Chrome force-opened on chrome://inspect every cold invocation — and if Chrome's inspect checkbox was still ticked, the agent ended up silently automating a fresh Chrome (without the user's logins) instead of their actual browser. Detect the running Chromium browser via ps and drive THAT one (_running_chromium_app), with the correct inspect scheme (edge:// for Edge, chrome:// otherwise). Falls back to Google Chrome when nothing matches; off macOS keeps the generic webbrowser path. Addresses browser-use#425.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #425 (the hardcoded-Chrome recovery).
Problem
_open_chrome_inspect()(admin.py) hardcodedtell application "Google Chrome"on macOS. So a user whose daily browser is a non-Chrome Chromium — Dia, Arc, Edge, Brave — got Google Chrome force-opened onchrome://inspect/#remote-debuggingon every cold harness invocation. Worse, per the issue: if Chrome's inspect checkbox happened to still be ticked, that freshly launched Chrome wrote a liveDevToolsActivePortand the agent then silently automated Chrome (without the user's logins) instead of their actual browser.Fix
Detect the running Chromium browser via
ps(_running_chromium_app) and drive that one in the AppleScript, using the correct inspect scheme (edge://for Edge,chrome://otherwise). Falls back to Google Chrome when nothing matches; off macOS keeps the genericwebbrowserpath. Mirrors the multi-browser name list already used by_chrome_running().Scope note (the issue describes two bugs)
DevToolsActivePort): already mitigated on currentmain—get_ws_url()'s per-profile loop now catchesOSErroron a dead port and advances to the next profile rather than raising. I verified this against a real machine: a stale dead-port Chrome file no longer shadows a healthy browser.Tests
New
tests/unit/test_open_chrome_inspect.py(6): prefers a running non-Chrome browser, Edge →edge://scheme, fallback to Chrome,Noneoff macOS, and_open_chrome_inspectdrives the detected app (Dia/Edge) not Chrome. Existingtest_admin.py(39) still green.Summary by cubic
Open the remote‑debugging inspector in the user's running Chromium browser on macOS (Dia, Arc, Edge, Brave, etc.) instead of always launching Google Chrome. Prevents unintended Chrome automation and uses the correct
edge://scheme for Edge. Addresses #425.psand open<scheme>://inspect/#remote-debuggingin that app through AppleScript; fall back to Google Chrome when none is running. Non‑macOS keeps the genericwebbrowserpath.edge://inspector; others usechrome://.Written for commit 4f72853. Summary will update on new commits.