Skip to content

fix(mobilerun): keep a failed state snapshot from answering 404 - #38

Merged
Timo972 merged 1 commit into
masterfrom
timo/dro-3213-ios-portal-state-slow-and-missingincorrect-packagename-after
Oct 2, 2026
Merged

Timo972 merged 1 commit into
masterfrom
timo/dro-3213-ios-portal-state-slow-and-missingincorrect-packagename-after

Conversation

@Timo972

@Timo972 Timo972 commented Sep 30, 2026

Copy link
Copy Markdown

Refs DRO-3213. Companion client fix: droidrun/mobilerun-ios#202

Problem

GET /mobilerun/state let a failed application snapshot fall through to the global exception mapping, which answers FBStaleElementException with 404. A stock WebDriverAgent answers a missing route with 404 too, so mobilerun-ios decided "this runner has no /mobilerun/state" and served every later /state from the /source dump. That took 5+ s (12+ s on SpringBoard), and packageName became the display name or nothing, since the source root carries no bundle ID.

The snapshot fails right after a Home press, when the app resolved at the start of the request is the one leaving the foreground.

Fix

  • Retry the snapshot once, with the active app resolved again. After a Home press that picks up SpringBoard.
  • If the retry also fails, answer 400 (invalid element state). That's neither the route-missing 404 nor a 5xx, which mobilerun-ios reads as a wedged runner and relaunches for (the DRO-3178 concern).
  • Other exceptions keep the global mapping.

The retry-and-map logic is a class method (+stateWithSnapshotAttempt:failure:), so it can be unit-tested without XCUI.

Tests

  • New FBMobilerunA11yCommandsTests: it failed against the old behavior (exception propagated, no retry) and passes now.
  • The full UnitTests suite passes (253 tests, 1 skipped) on the iPhone 17 Pro simulator.
  • WebDriverAgentLib_tvOS builds.
  • Not yet verified on hardware. Re-QA on iOS 26.5 WDA and iOS 27 native is pending.

🤖 Generated with Claude Code

GET /mobilerun/state let a failed application snapshot fall through to the
global exception mapping, which answers FBStaleElementException with 404.
That is also what a stock WebDriverAgent answers for the missing route, so
mobilerun-ios latched "no /mobilerun/state on this runner" and served every
later /state from the /source dump: 5+ s (12+ s on SpringBoard), and with the
display name or nothing as packageName, since the source root carries no
bundle ID.

The snapshot fails right after a Home press, when the app resolved at the
start of the request is the one leaving the foreground. Retry once with the
active app resolved anew, and if that fails too answer 400 (invalid element
state): neither the route-missing 404 nor a wedged-runner 5xx.

Refs DRO-3213

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Timo972
Timo972 merged commit b0e3a36 into master Oct 2, 2026
39 of 50 checks passed
@Timo972
Timo972 deleted the timo/dro-3213-ios-portal-state-slow-and-missingincorrect-packagename-after branch October 8, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants