Repository navigation
Conversation
…of ambiguity errors An app whose windows were all on another Space listed no windows, so snapshot and screenshot failed with advice to wait. The window server still places those windows on a Space; list them as on_other_space, say so when a tree read cannot reach them, and let focus-window switch to them. A window AMBIGUOUS_TARGET listed titles, which in a browser are the user's open tabs.
…indow errors Review of #325 found that the new window_on_other_space kind broke paths that treated a window without an accessibility tree as temporary: - wait and post-action observation now keep polling through window_on_other_space, and the owned-surface fallback accepts it, as they already did for window_without_accessibility_element. - The app-scoped inventory remembers the last Space placement per window number, so a window does not drop out of one poll and return in the next when that poll's best-effort Space read times out (spurious window events). - The Space read worker stops at three quarters of the budget, so the placements it already read reach the caller instead of being lost. - focus-window: errors after the activation are annotated as delivered, the command deadline running out is a TIMEOUT (window_space_switch), a window on screen without its element keeps that error, and the suggestion says macOS only switches Spaces when the app has no window on the Space on screen. - screenshot --app uses the app-scoped inventory only where the adapter says so (macOS); Linux and Windows keep the process-wide lookup.
Second review round on #325's other-Space handling: - A lookup that fails because the command deadline ran out during the Space switch wait now becomes the window_space_switch TIMEOUT instead of the generic deadline error, and that timeout suggests a longer --timeout. - A window seen on another Space at any point in the wait is reported as having stayed there, so a Space read that times out on the last poll does not turn it into "not exposed through accessibility". - application_activated reflects whether the activation started. - A sheet, popover or alert read for a window on another Space keeps window_on_other_space when the current-Space fallback finds nothing, instead of ELEMENT_NOT_FOUND. - The remembered Space placements cover windows past the 32-read cap, and the shared memory is no longer locked while the read waits.
…r-Space error ErrorCode is not Copy; the previous commit took it from a borrowed error.
… in hand Removes the expect() the workspace lints forbid.
This branch has not been deployed
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.
What and why
Field test (macOS 26, a browser on another Space):
list-windows --appreturned[]. Snapshots failedWINDOW_NOT_FOUNDwith "wait for the app to present a window".screenshot --window-idfailed.screenshot --appfailedAMBIGUOUS_TARGETwith 16 candidates whose titles were the user's open tabs.Root cause:
narrow_to_real_windows(window_inventory.rs) keeps a window only when it is visible or has a minimized state. macOS drops a window on another Space fromAXWindows, so it had neither and was dropped as if the app had ordered it out. CoreGraphics still lists it (the list option iskCGWindowListOptionAll, so CG is not the cause).Changes:
WindowState.on_other_space: Option<bool>, serialized only when known.CGSCopySpacesForWindows. A window on some Space but not the current one is kept withon_other_space: true. At most 32 windows per inventory, one worker, 100 ms budget. An inventory with no such windows makes no call.snapshotandfindon such a window:ACTION_NOT_SUPPORTEDwindow_on_other_space, namingfocus-window.focus-window: activates the app so macOS switches Spaces, waits up to 1.5 s for the AX element, then raises the window. If the window stays away, the error addsapplication_activated: true.screenshot --apppicks among the app-scoped windows, not every off-screen window of the process.AMBIGUOUS_TARGETcandidates are{id, is_focused, visible, on_other_space?}, with no titles. The macOSverified_window_title_ambiguouserror names the window id instead of the title.app_has_no_windowsuggestion now nameslist-windowsandfocus-window.How tested
cargo clippy -p agent-desktop-macos -p agent-desktop-core -p agent-desktop -p agent-desktop-ffi --target aarch64-apple-darwin --all-targets -- -D warnings: clean (xcrun shim, check only).cargo check -p agent-desktop-windows -p agent-desktop-core --target x86_64-pc-windows-msvc --all-targets: clean.scripts/cargo-test-isolated-home.sh testover the host set: all passed (core 2350). Pre-commit gates passed.window_inventory_space_tests,window_space_tests,focus_other_space_tests,window_resolve_liveness_tests. They run in macOS CI only.Risks / to confirm on the Mac
CGSCopySpacesForWindowsmasks (all = 7, current = 5) come from public reverse-engineered headers. Confirm them live: one window on Space 2 should showon_other_space: true, and the same window on screen should not appear as on another Space. Also check with two displays.list-windows --applatency when an app owns many off-screen helper windows (browsers). Runperf-baseline-compare.sh --apps "Google Chrome".focus-windownow activates the app before the window has an AX element. This is a visible Space switch, and only happens for a window already known to be on another Space.