Repository navigation
Conversation
System Settings popup buttons answer kAXErrorNoValue for AXWindow even though an AXWindow encloses them. ancestor_viewport then had no viewport, the live offscreen state stayed unknown, and because a popup button never reports AXExpanded the actionability gate waited out its whole 5 s budget. select, click and expand on these popups failed with TIMEOUT and a "target may be busy" suggestion. When AXWindow has no value, the viewport now starts from the first AXWindow in the parent chain. A chain that reaches the application without a window, as open menu content does, still has no viewport.
An open popup menu hangs off its popup button, so its parent chain passes through the enclosing AXWindow. The window-ancestor fallback would have given menu items that window's viewport, and an item drawn outside the window would read as offscreen. The search now stops at the first menu role, so menu content keeps no viewport, as it had before the fallback. Measured on a System Settings popup: select takes about 2.9 s with and without this guard, and changes the value in both builds.
Contributor
|
@joeVenner is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
gshost1
added a commit
to gshost1/agent-desktop
that referenced
this pull request
Nov 8, 2026
…ercel-labs#453) (#6) * fix(macos): find the window of a control that omits AXWindow System Settings popup buttons answer kAXErrorNoValue for AXWindow even though an AXWindow encloses them. ancestor_viewport then had no viewport, the live offscreen state stayed unknown, and because a popup button never reports AXExpanded the actionability gate waited out its whole 5 s budget. select, click and expand on these popups failed with TIMEOUT and a "target may be busy" suggestion. When AXWindow has no value, the viewport now starts from the first AXWindow in the parent chain. A chain that reaches the application without a window, as open menu content does, still has no viewport. * fix(macos): keep menu content out of the window-ancestor fallback An open popup menu hangs off its popup button, so its parent chain passes through the enclosing AXWindow. The window-ancestor fallback would have given menu items that window's viewport, and an item drawn outside the window would read as offscreen. The search now stops at the first menu role, so menu content keeps no viewport, as it had before the fallback. Measured on a System Settings popup: select takes about 2.9 s with and without this guard, and changes the value in both builds. * test(macos): move element_bounds tests beside the module The carried window-ancestor fallback put element_bounds.rs at 406 lines, over the 400-line cap; its inline tests now live in element_bounds_tests.rs as the layout rule asks. * fix(macos): keep the window-ancestor fallback from judging own-surface content or failing reads Review of the carried fallback found three gaps. A menu or popover used as the start element still walked up to its host window and read as offscreen; a popover's content was not stopped at all; and an unreadable parent chain on the fallback now failed state reads that used to report an unknown viewport. The search now starts at the element itself, stops at AXPopover as well as the menu roles, and any fallback read failure leaves the viewport unknown as before. The primary AXWindow path and its clipping walk are unchanged. --------- Co-authored-by: joeVenner <ylafrimi@gmail.com>
Collaborator
|
closing as fixed in #705 on main ( |
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.
Summary
select,click, andexpandon a System Settings popup button waited out the 5 s actionability budget and failed withTIMEOUTand the suggestion "The target application may be busy or unresponsive". The live viewport read now finds the popup's window through its parent chain, so the visibility check can pass.Related issues
None found. On System Settings,
selectalso needs the menu-search fix in #399: after this PR the gate passes, but without #399 the menu search stops at an invalid node andselectfails withELEMENT_NOT_FOUND. With both changes,selectchanges the value.Type of change
fix:— bug fixChanges
The popup buttons in System Settings answer
kAXErrorNoValue(-25212) forAXWindow, although their parent chain reaches anAXWindowseven levels up whose bounds read normally.ancestor_viewportreturnedNoneas soon asAXWindowhad no value, so the liveoffscreenstate stayed unknown.A popup button maps to the
comboboxrole. That role is expandable, and the button never exposesAXExpanded, sostates_are_completereportsfalse. The core visibility gate (gates.rs) treats an unknownoffscreenwith incomplete states asunknown, and the actionability wait never ends. The same failure hit the File Format popup in TextEdit's save sheet.When
AXWindowhas no value,ancestor_viewportnow starts from the firstAXWindowancestor and runs the existing clipping walk unchanged.first_window_ancestorstops without a window atAXApplication, at a missing role, or at the first menu role (AXMenu,AXMenuItem,AXMenuBarItem, orAXMenuBar). Menu content therefore keeps no viewport, as before: an open menu draws outside the window and would otherwise read as offscreen.I kept the core gate as it is because Windows and Linux share it. The fix supplies the evidence the gate is missing rather than loosening the gate.
How tested
cargo fmt --all -- --checkcargo clippy "${HOST_PKGS[@]}" --all-targets -- -D warningscargo test "${HOST_PKGS[@]}" --libcargo test -p agent-desktopcargo test -p agent-desktop-ffi --testsAGENT_DESKTOP_E2E_EXCLUSIVE=1 bash tests/e2e/run.sh(requires--releasebuild + AX permission; run when behavior changes)New tests in
element_bounds.rscover a popup button chain that reaches its window, a menu-bar chain, a popup menu item inside a window, an ancestor without a role, and an unbounded chain. The window test fails if the fallback returnsNone, and the popup-menu test fails without the menu-role guard.Live, on macOS 26 (Darwin 25.5), with #399's change applied:
selecton Window title bar double-click action in Desktop & Dock returneddelivered_verified.defaults read -g AppleActionOnDoubleClickchanged from unset toMinimize, and back toMaximizeafter selecting Zoom. I deleted the key afterwards. Eachselecttakes about 2.9 s with and without the menu-role guard. Before the change, the same call returnedTIMEOUTafter 5,031 ms with the single failing checkvisible: live offscreen state unavailable.E2E and perf ran on a merge of this PR with my three other macOS fix PRs, compared with
mainat9eb9b296.E2E: 58 passed, 13 failed, 1 skipped. The failures also occur on
main. On this machine (macOS 26, 5K display), the fixture'sAXScrollAreareports a frame that covers only the right half of its 1770×1080 window. The 27 controls in the left column readoffscreen, and actions on them fail the visibility check. Both binaries list the same 27 controls as offscreen, and every failing assertion targets one of them. Onmainthe suite stops earlier, at thesafe-semantic.shgate, for the same reason.Perf (
scripts/perf-baseline-compare.sh, 10 rounds, p50, this PR thenmain):mainsnapshot -igettypesnapshot -isnapshot -isnapshot d30find --role button --firstThe fixture
clickcase fails on both binaries for the offscreen reason above. That failure ends the script early, so I ran its remaining steps by hand.Checklist
type: description, lowercase, no capital after colon)cargo fmtandcargo clippy -D warningsare cleanunwrap()added in non-test code///doc-comments on public items)