From 54dc68f3baa6aa6c6c684570a02bc600441bfe7a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Nov 2026 01:29:45 +0100 Subject: [PATCH 1/4] =?UTF-8?q?AI:=20harness=20=E2=80=94=20give=20up=20on?= =?UTF-8?q?=20a=20walk=20the=20app=20has=20stopped=20accepting=20events=20?= =?UTF-8?q?from?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XCUITest waits for the app to report itself idle before it will synthesize a tap or a swipe. This app does not always get there, and when it does not the wait runs out after about two minutes and the event never happens. Measured in tonight's campaign: stalls of 120s, 190s and 233s inside a 300s episode, and four of seven episodes lost 60-85% of their steps to them. The earlier w8 campaign, which rarely left a transaction in a working state, had 31 of 31 episodes succeed — so this appeared with the flows the new URI kinds reach, not with the driver. Continuing after the first stall only buys another stall, so the walk now records an `event-stall` and stops, and the orchestrator starts a fresh episode: the remaining steps of a wedged episode are worth less than a whole new one. `app-never-idle` reports it, because an app that cannot be sent an event is a finding about the app, not only about the harness. Assisted by LLM --- .../TalerFuzzUITests/FuzzExplorerTests.swift | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/harness/TalerFuzzUITests/FuzzExplorerTests.swift b/harness/TalerFuzzUITests/FuzzExplorerTests.swift index 8c88e42b..a4aab2ab 100644 --- a/harness/TalerFuzzUITests/FuzzExplorerTests.swift +++ b/harness/TalerFuzzUITests/FuzzExplorerTests.swift @@ -28,6 +28,10 @@ final class FuzzExplorerTests: XCTestCase { try? out.finish() } + /// An action that takes longer than this did not happen: XCUITest spent + /// the time waiting for an app that never reported itself idle. + static let stallSeconds: TimeInterval = 45 + func testExplore() throws { let app = XCUIApplication(bundleIdentifier: cfg.bundleID) var env = cfg.appEnv @@ -193,8 +197,30 @@ final class FuzzExplorerTests: XCTestCase { lastTarget = chosen.target lastHash = hashNow visited.insert(chosen.target) + // Time the action. XCUITest waits for the app to report itself + // idle before it will synthesize an event, and this app does not + // always get there: once a transaction is left in a working state + // its indefinitely repeating rotation animation keeps Core + // Animation busy, so "Wait for ... to idle" runs out after about + // two minutes and the event fails. Measured in this campaign: + // stalls of 120s, 190s and 233s, each eating most of a 300s + // episode, and four of seven episodes lost 60-85% of their steps. + // + // Continuing after the first stall only buys another stall, so + // the walk gives up and lets the orchestrator start a fresh + // episode, which is worth far more than the remaining steps. + let actionStart = Date() perform(chosen, app: app) + let actionSeconds = Date().timeIntervalSince(actionStart) seq += 1 + if actionSeconds > Self.stallSeconds { + out.note(event: "event-stall", + detail: "\(chosen.kind.rawValue) on \(chosen.target) took " + + String(format: "%.0f", actionSeconds) + + "s; the app never reported idle", + tMs: ms()) + break + } // Fund first, then turn the phone: OIM only exists over the // balances list. -- 2.47.3 From c59a9a1703a9ed981e3468c411eb05df89a9ec55 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Nov 2026 02:01:26 +0100 Subject: [PATCH 2/4] =?UTF-8?q?AI:=20harness=20=E2=80=94=20bound=20what=20?= =?UTF-8?q?one=20wedged=20action=20can=20cost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An episode ran 1037s against a 420s timeout and produced three steps. Two things were wrong. `run()` used `subprocess.run(timeout=...)`, which kills the direct child and then waits for the pipes to close — and xcodebuild's grandchildren hold the same pipe. The timeout fired on schedule and the wait afterwards did not return until the test finished on its own. It now runs the command in its own session and kills the process group. A hard kill loses the episode's tail, so the walk also gives itself a wall-clock budget (`walk_budget_s`, 600s) and stops on its own at the next step, writing out everything it saw. The process-group kill moves to 900s and is only the backstop. Neither replaces the stall guard: that one stops a walk after a single unresponsive action, this one bounds how long that action may cost. Assisted by LLM --- harness/TalerFuzzUITests/FuzzExplorerTests.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/harness/TalerFuzzUITests/FuzzExplorerTests.swift b/harness/TalerFuzzUITests/FuzzExplorerTests.swift index a4aab2ab..349ccbda 100644 --- a/harness/TalerFuzzUITests/FuzzExplorerTests.swift +++ b/harness/TalerFuzzUITests/FuzzExplorerTests.swift @@ -101,6 +101,13 @@ final class FuzzExplorerTests: XCTestCase { try record(app: app, seq: seq, kind: "initial", action: nil) while seq < cfg.maxSteps { + if cfg.maxSeconds > 0, + Date().timeIntervalSince(start) > Double(cfg.maxSeconds) { + out.note(event: "budget-spent", + detail: "stopping after \(cfg.maxSeconds)s at step \(seq)", + tMs: ms()) + break + } // .runningBackgroundSuspended is what the app legitimately enters // after the walk's own background action; treating it as gone // reported a healthy app as having exited. Only a genuinely -- 2.47.3 From 608812dee5fb0d58f8bcf03b6f79e7293c3c0cb2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Nov 2026 02:43:25 +0100 Subject: [PATCH 3/4] =?UTF-8?q?AI:=20harness=20=E2=80=94=20one=20slow=20ac?= =?UTF-8?q?tion=20is=20not=20a=20reason=20to=20abandon=20a=20walk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stall guard gave up on the first unresponsive action, and the first episode to hit one ended after a single step: opening the terms of service took 74s, and that is on the critical path of the withdrawal flow, so most episodes would have died at step two. Waiting out an occasional slow action is the better trade; four of them in one walk is not. The wall-clock budget bounds the total either way. Assisted by LLM --- .../TalerFuzzUITests/FuzzExplorerTests.swift | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/harness/TalerFuzzUITests/FuzzExplorerTests.swift b/harness/TalerFuzzUITests/FuzzExplorerTests.swift index 349ccbda..22a550c6 100644 --- a/harness/TalerFuzzUITests/FuzzExplorerTests.swift +++ b/harness/TalerFuzzUITests/FuzzExplorerTests.swift @@ -32,6 +32,9 @@ final class FuzzExplorerTests: XCTestCase { /// the time waiting for an app that never reported itself idle. static let stallSeconds: TimeInterval = 45 + /// How many stalled actions a walk puts up with before it gives up. + static let stallsTolerated = 4 + func testExplore() throws { let app = XCUIApplication(bundleIdentifier: cfg.bundleID) var env = cfg.appEnv @@ -82,6 +85,7 @@ final class FuzzExplorerTests: XCTestCase { /// Targets already acted on in this episode, for the novelty bias. var visited = Set() var repeatCount = 0 + var stalls = 0 var lastHash = "" let screen = app.frame var seq = 0 @@ -221,12 +225,23 @@ final class FuzzExplorerTests: XCTestCase { let actionSeconds = Date().timeIntervalSince(actionStart) seq += 1 if actionSeconds > Self.stallSeconds { + stalls += 1 out.note(event: "event-stall", detail: "\(chosen.kind.rawValue) on \(chosen.target) took " + String(format: "%.0f", actionSeconds) - + "s; the app never reported idle", + + "s; the app never reported idle (stall \(stalls))", tMs: ms()) - break + // Tolerate a few: a single slow action is common -- opening the + // terms of service cost 74s once -- and giving up on the first + // one ended an episode after a single step, which is a worse + // trade than waiting. Give up only when it is persistent; the + // wall-clock budget bounds the total either way. + if stalls >= Self.stallsTolerated { + out.note(event: "event-stall-giving-up", + detail: "\(stalls) stalled actions; ending the walk", + tMs: ms()) + break + } } // Fund first, then turn the phone: OIM only exists over the -- 2.47.3 From 1b40027d79e9642226263d59bf0474534719117f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Nov 2026 06:52:52 +0100 Subject: [PATCH 4/4] =?UTF-8?q?AI:=20harness=20=E2=80=94=20a=20step=20can?= =?UTF-8?q?=20hang=20in=20a=20snapshot,=20not=20only=20in=20an=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stall guard timed perform(), so it caught a tap that never landed but not a step that hung inside app.snapshot() during the settle or decision pump -- the same accessibility machinery, blocking just as long. One walk spent 903 seconds between choosing its third action and the budget cutting it off, with no stall recorded at all. Timing the whole step records those as step-stall, and app-never-idle reports them, so the evidence on issue 11949 stops under-counting the thing it is about. Assisted by LLM --- .../TalerFuzzUITests/FuzzExplorerTests.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/harness/TalerFuzzUITests/FuzzExplorerTests.swift b/harness/TalerFuzzUITests/FuzzExplorerTests.swift index 22a550c6..7900bf54 100644 --- a/harness/TalerFuzzUITests/FuzzExplorerTests.swift +++ b/harness/TalerFuzzUITests/FuzzExplorerTests.swift @@ -104,7 +104,27 @@ final class FuzzExplorerTests: XCTestCase { try record(app: app, seq: seq, kind: "initial", action: nil) + var stepStart = Date() while seq < cfg.maxSteps { + // Time the whole step, not just the action. + // + // The stall guard below times `perform()`, so it sees a tap that + // never lands -- but not a step that hangs inside `app.snapshot()` + // during the settle or decision pump, which goes through the same + // accessibility machinery and can block just as long. One walk + // spent 903 seconds between choosing its third action and the + // budget cutting it off, with no stall recorded at all, because + // the time went to a snapshot rather than to an event. + let stepSeconds = Date().timeIntervalSince(stepStart) + if seq > 0 && stepSeconds > Self.stallSeconds { + stalls += 1 + out.note(event: "step-stall", + detail: "step \(seq) took " + + String(format: "%.0f", stepSeconds) + + "s outside the action itself (snapshot or pump)", + tMs: ms()) + } + stepStart = Date() if cfg.maxSeconds > 0, Date().timeIntervalSince(start) > Double(cfg.maxSeconds) { out.note(event: "budget-spent", -- 2.47.3