fix(ios): refuse a lit-panel window walk that recorded an XCTest issue

Merged
IM
3d ago
+100-22

Summary

Closes #5023.

On a lit-panel request, XCTest answers an app tree it cannot snapshot with an empty window list and a recorded issue, not an exception. The booking read that as an app without windows and refused with APP_SCREEN_WINDOW_UNRESOLVED, whose message names a system-surface fallback that gestures never try.

  • bookRequestLitPanelSurface holds the walk's XCTest issues. A walk that finds no window and records one (a rejected tree, a window gone mid-walk, a hung query) refuses with a new unreadableWindows refusal: APP_SCREEN_UNRESOLVED, dispatched: no, and its own message and hint. Without an issue it stays APP_SCREEN_WINDOW_UNRESOLVED; a walk that books a window keeps it.
  • Held issues are recorded again, so AX-issue muting and the hung-query rule are unchanged.
  • The APP_SCREEN_WINDOW_UNRESOLVED message no longer claims the system surface was asked.

The gesture still does not dispatch: it needs the booked window for its display and frame (#3870).

Before / after

iPhone Duo simulator (iOS 27.2), test app heavy feed, base 63fe1b6fe, head f299f0f55. JSON trimmed to the error fields.

$ agent-device press 'id="heavy-post-0-like"' --json
base: APP_SCREEN_WINDOW_UNRESOLVED, dispatched: no
      "Neither the target app nor the system surface resolved a window, so no display could be named."
head: APP_SCREEN_UNRESOLVED, dispatched: no
      "XCTest recorded an issue while reading the target app's windows on the lit panel, so they could not be read."

runner.log (head, consecutive lines):
AGENT_DEVICE_RUNNER_RECORDED_ISSUE_HELD issue=Failed to resolve query: Error kAXErrorIllegalArgument getting snapshot for element <AXUIElementRef> {pid=11449} {uid=[ID:1 hash:0x0]}
AGENT_DEVICE_RUNNER_LIT_PANEL_WINDOW lit=1(466x678) windows=0 outcome=no resolved application window frame=(inf,inf 0x0)
AGENT_DEVICE_RUNNER_AX_SNAPSHOT_ISSUE_SUPPRESSED count=1 description=Failed to resolve query: Error kAXErrorIllegalArgument getting snapshot for element <AXUIElementRef> {pid=11449} {uid=[ID:1 hash:0x0]}
AGENT_DEVICE_RUNNER_LIT_PANEL_WINDOW_UNREAD issues=1

Liked posts: 0 at both. On Settings, head books windows=2 and the press lands.

Validation

  • Head f299f0f55: check:affected --run --head (exactCommit: true) passed format through vitest-related; pnpm gate provider-integration (317 tests), adr-citations, xctest-selection, runner-error-codes and packaged-runner-swift passed.
  • The new runner test passes on the Duo and fails with each of: the base booking code, no issue check, no outcome check, no re-record, .unresolvedScreen in its place, the old message and hint, and a guard that admits only kAX issues.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.