Skip to content

mac-approve returns not-found on Chrome 153: the Allow sheet name is missing value #878

Open

Description

@DrBUBU12

Summary

mac-approve returns not-found while Chrome's "Allow remote debugging?" sheet is on screen, so the waiting browser command stays blocked. Chrome 153 leaves the sheet's own name empty (missing value) and puts the visible title in a child AXHeading; the helper only matches the sheet's name.

Repro

  1. macOS, Chrome 153, remote debugging enabled at chrome://inspect/#remote-debugging, Accessibility already granted to the launching terminal/Codex.
  2. Start any browser-harness command that triggers the per-connection sheet:
browser-harness <<'PY'
print(page_info())
PY
  1. While the sheet is visible, run in another shell:
browser-harness mac-approve

Actual: not-found, with the detail "retry the browser command and run browser-harness mac-approve when the prompt appears". The sheet is still on screen; the daemon stays in handshake-wait.

Expected: ready, and the waiting command resumes.

In System Events the sheet is an AXSheet whose name is missing value, and the title string lives in a child AXHeading. entire contents sometimes returns empty during the handshake, so the current name-only match never finds the sheet. This is not an Accessibility problem and not the localization problem from #707: the matches are the English literals.

Environment

OS: macOS (Darwin 25.x)
Chrome version: 153
browser-harness: 0.1.13; the same name-only match is still on current main (src/browser_harness/macos.py)
browser-harness --doctor: chrome running [ok], daemon alive [ok], active browser connections [ok] once the sheet is accepted

Suggested fix

File to change: src/browser_harness/macos.py, inside the _APPLESCRIPT string. Both the new handler and the sheet loop are part of that script; the Python wrapper around it does not change. A regression check belongs in tests/unit/test_macos.py; the existing tests there assert on the script passed to osascript.

Keep the existing name match and fall back to walking UI elements for an AXHeading titled "Allow remote debugging?" before pressing Allow. Recursion over UI elements is used instead of entire contents because the latter intermittently returns empty during the handshake.

Add to the AppleScript:

on hasApprovalTitle(nodeRef)
    try
        if (role of nodeRef as text) is "AXHeading" and ¬
            (name of nodeRef as text) is "Allow remote debugging?" then
            return true
        end if
    end try
    try
        repeat with childRef in UI elements of nodeRef
            if my hasApprovalTitle(childRef) then return true
        end repeat
    end try
    return false
end hasApprovalTitle

and in the sheet loop:

repeat with s in sheets of w
    set isTargetSheet to false
    if (name of s as text) is "Allow remote debugging?" then
        set isTargetSheet to true
    else
        set isTargetSheet to my hasApprovalTitle(s)
    end if
    if isTargetSheet then
        if my clickAllow(s) then
            set resultText to "ready"
            exit repeat
        end if
    end if
end repeat

With this patch mac-approve returns ready while the sheet is visible and the waiting page_info() completes. osacompile accepts the script; pytest tests/unit passes (267 passed, 1 skipped).

Related

I searched existing issues for AXHeading, missing value, and mac-approve not-found before filing; no report covers this case.

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