Repository navigation
Description
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
- macOS, Chrome 153, remote debugging enabled at
chrome://inspect/#remote-debugging, Accessibility already granted to the launching terminal/Codex. - Start any browser-harness command that triggers the per-connection sheet:
browser-harness <<'PY'
print(page_info())
PY- While the sheet is visible, run in another shell:
browser-harness mac-approveActual: 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 hasApprovalTitleand 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 repeatWith 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
mac-approvematch the Allow sheet ("Allow remote debugging?" / "Allow") in non-English Chrome #707 / fix: match Chrome's localized Allow sheet in mac-approve #747 match localized sheet titles by exactnameand will hit the same missing-name case on Chrome 153+. If fix: match Chrome's localized Allow sheet in mac-approve #747 lands first, the heading fallback should compare against that title table.- The proposed
macos-remote-debuggingskill recipe onfix/661-macos-auto-approvematches sheet names only and needs the same fallback.
I searched existing issues for AXHeading, missing value, and mac-approve not-found before filing; no report covers this case.
Activity