Skip to content

mac-approve only works for stock Google Chrome — Brave/Edge/Canary/Arc users get "setup-required" for a toggle they already enabled #687

Description

@rajarshidattapy

Labels: bug, macos

Description

browser-harness mac-approve is the documented escape hatch for macOS's per-connection
"Allow remote debugging?" sheet. Both of its moving parts are hard-coded to stock
Google Chrome.

The gate:

# src/browser_harness/macos.py:60-66
def _google_chrome_root() -> Path:
    return Path.home() / "Library/Application Support/Google/Chrome"

def _google_chrome_toggle_enabled() -> bool:
    """Only accept the toggle from the Google Chrome root used by the script."""
    return _google_chrome_root() in remote_debugging_toggle_profiles()

The AppleScript:

if exists process "Google Chrome" then
    tell process "Google Chrome"

daemon._MAC_PROFILES, meanwhile, supports eight browsers:

"Library/Application Support/Google/Chrome",
"Library/Application Support/Google/Chrome Canary",
"Library/Application Support/Comet",
"Library/Application Support/Arc/User Data",
"Library/Application Support/Dia/User Data",
"Library/Application Support/Microsoft Edge",          # + Beta / Dev / Canary
"Library/Application Support/BraveSoftware/Brave-Browser",

Impact

A Brave (or Edge, Canary, Arc, Dia, Comet) user on macOS:

  1. Runs browser-harness, hits the Allow sheet.

  2. ensure_daemon() prints "run browser-harness mac-approve in another shell"
    (admin.py:392-397 — this hint is not conditioned on which browser is in use).

  3. Ticks "Allow remote debugging for this browser instance" in their browser.

  4. Runs mac-approve and gets:

    setup-required: first enable "Allow remote debugging for this browser instance" at
    chrome://inspect/#remote-debugging, then run `browser-harness mac-approve` again
    

The message is wrong — they did enable it — and it is unactionable, because
remote_debugging_toggle_profiles() correctly reports their Brave profile while
_google_chrome_toggle_enabled() only ever looks at the Chrome path. Even if the gate
passed, the AppleScript would find no process "Google Chrome" and return not-found.

This is the only unattended path past the sheet, so these users have no way to run the
harness without a human clicking the button every time.

Suggested fix

Resolve the browser once and use it for both halves:

_MAC_APP_FOR_PROFILE = {
    "Google/Chrome": "Google Chrome",
    "Google/Chrome Canary": "Google Chrome Canary",
    "Microsoft Edge": "Microsoft Edge",
    "BraveSoftware/Brave-Browser": "Brave Browser",
    "Arc/User Data": "Arc",
    "Dia/User Data": "Dia",
    "Comet": "Comet",
}

Pick the first entry in remote_debugging_toggle_profiles() that maps to a known app,
template its name into the AppleScript's process "..." lines, and only return
setup-required when no supported profile has the toggle on. admin._browser_launch_spec()
already does the profile-path → macOS-app-name mapping and could be reused rather than
duplicated.

If a browser genuinely can't be supported, the error should name it
("mac-approve does not support Arc") instead of claiming the user skipped a step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions