iOS: resolveRunnerWindow fails when an unused trailing window disappears
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- ios, swift
- Bereich
- mobile, testing-qa
Rechercherichtung
Beginne in apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift bei resolveRunnerWindow(app:), und führe dann die verknüpfte native Reproduktion mit ./reproduce.sh aus. Erledigt ist die Arbeit, wenn der Resolver das erste nutzbare, nicht leere Fenster zurückgibt, ohne unnötige nachfolgende Fenster zu lesen, den app.frame-Fallback beibehält und die Reproduktion ohne den stale-element-Fehler besteht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug
resolveRunnerWindow(app:) eagerly reads the frame of every app window before returning the first usable one. If an unused trailing window disappears between its exists check and its frame read, XCTest records a failure even though the first/main window is still available.
Affected implementation: Agent Device 0.21.15; also still present in upstream source at 3660c7fa.
Small native reproduction
Public repo: https://github.com/wcastand/agent-device-window-race-repro
Verified commit: b1baf97
The fixture is a small UIKit app with a persistent main UIWindow. It shows a second window every 5 seconds, then hides/releases it after 600 ms. Two XCUITests repeatedly call the extracted original resolver or the proposed short-circuit version using real XCUIApplication/XCUIElement objects. No Expo/React Native, backend, account, mocked failures, or hooks/delays inside the resolver are involved.
git clone https://github.com/wcastand/agent-device-window-race-repro.git
cd agent-device-window-race-repro
./reproduce.sh <iOS-simulator-UDID>
The Xcode project is included; no package install or signing team is needed. Each loop is bounded to 60 seconds / 6,000 calls. This is a natural timing race, so a run can miss it. The script returns success only if the original produces the specific stale-element failure and the patched test passes; setup errors and missed races are rejected.
Observed vs expected
On Xcode 27.0 (27A266a), macOS 27.0 arm64, iPhone 18 Pro simulator / iOS 27.0, the script exited 0:
- Original: failed on call 332 (zero-based iteration 331).
- Patched: completed 3,843 calls over one minute, no failures.
- The original failure was also observed separately on iPhone 17 / iOS 26.5.
Checking existence of `Window (Element at index 1)`
Find the Window (Element at index 1)
Find the Window (Element at index 1) (retry 1)
Find the Window (Element at index 1) (retry 2)
Failed to get matching snapshot: No matches found for Element at index 1 from input {(
Window (Main)
)}
Expected: return the first usable window without resolving later windows that cannot affect the result. The repro isolates the native resolver; it does not run the full CLI/daemon or reproduce a keyboard-specific lifecycle.
Proposed patch
Downloadable patch, checked against the upstream source path:
--- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift
+++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift
@@ -226,12 +226,13 @@
/// display can never name a different window than the one the reference frame was measured on.
func resolveRunnerWindow(app: XCUIApplication) -> (window: XCUIElement?, frame: CGRect) {
let windows = app.windows.allElementsBoundByIndex
- var frames: [CGRect?] = []
- for window in windows {
- frames.append(window.exists ? window.frame : nil)
- }
- if let index = Self.firstUsableWindowIndex(frames: frames) {
- return (windows[index], frames[index] ?? .zero)
+ // Stop at the first usable window. Later keyboard/overlay windows can disappear
+ // between exists and frame, recording an XCTest failure before a valid tap.
+ for window in windows where window.exists {
+ let frame = window.frame
+ if !frame.isEmpty {
+ return (window, frame)
+ }
}
return (nil, app.frame)
}
This preserves first-non-empty-window selection and the app.frame fallback. It avoids unnecessary trailing-window reads; it does not make exists + frame atomic or claim to fix disappearance of the selected window.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 5.1k
- Forks
- 339
- Ø Merge
- 11 Std. 59 Min.
- Gemergte PRs (30 T.)
- 736
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus callstack/agent-device
-
Limrun iOS fill reports success but drops non-ASCII textEvtl. vergeben @mvanhorn hat das vor 1 Tag übernommen. Offenbug ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 87/100
callstack/agent-device#3819 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
callstack/agent-device#1869 ·
Maintainer antworten meist innerhalb von 1 Tag
-
iOS: XCTest runner publishes window-relative frames and shifted taps for an iPad app that does not fill the screen (Windowed Apps / Stage Manager)Evtl. vergeben @thymikee hat das heute übernommen. Offenneeds-triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
callstack/agent-device#3899 ·
Maintainer antworten meist innerhalb von 1 Tag
-
iOS 27: `_UIFloatingBarContainerView` still marks content "covered" when the container matches its parent or sits a few points below the viewport topEvtl. vergeben @jonstuebe hat das heute übernommen. Offenbug
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 68/100
callstack/agent-device#3883 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 24/100
callstack/agent-device#3871 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in callstack/agent-device
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
logto-io/logto#9837 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
lingdojo/kana-dojo#32964 · 1 Kommentar · 5 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
Documentation status: needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
mastra-ai/mastra#28194 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
priority-low refactor-3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 3 Tagen