Repository navigation
fix(wda): a launch right after a reinstall waits for iOS to register the app - #257
Merged
omnarayan merged 1 commit intoOct 29, 2026
Conversation
…the app Right after clearState's reinstall on a real iPhone, iOS may not have registered the app yet, and WDA's launch fails with FrontBoard's NotFound (FBSOpenApplicationErrorDomain Code=4). Both launches now send it again every 500 ms for up to 10 s: /wda/apps/launch, and a new session with the app's bundleId. A launch that needed it logs one line. Any other error, and the last NotFound after 10 s, fail the launch as before. Fixes devicelab-dev#251
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Fixes #251. Right after
clearState's reinstall on a real iPhone, iOS may not have registered the app yet, and WDA's launch fails with FrontBoard's NotFound (FBSOpenApplicationErrorDomain Code=4). Both launches the WDA driver makes now send it again every 500 ms for up to 10 s, then fail with the last error.Type of Change
Changes Made
Client.postLaunchposts a launch and sends it again while WDA's error holdsFBSOpenApplicationErrorDomain Code=4, everylaunchRetryEvery(500 ms) untillaunchRetryFor(10 s) has passed. Then it returns the last error. Any other error returns at once.LaunchAppWithArgs:/wda/apps/launch,launchAppwhen there is a session;CreateSession: a session with abundleIdlaunches the app. That coversEnsureSessionat a flow's start, andlaunchAppwhen there is no session yet.WDA launch of <bundleId>: iOS had not registered the app yet; launched after 2 tries in 3.03s. A launch that gave up logs… iOS still did not know the app after 21 tries in 10.2s.clearState. So an app that is not installed at all now fails after 10 s instead of at once, with the same error.launch_retry_test.go, a fake WDA):TestLaunchAppWaitsForIOSToRegisterTheAppandTestLaunchAppWithoutSessionWaitsForIOSToRegisterTheApp: three Code=4 answers, then a 200. One goes throughlaunchAppwith a session (/wda/apps/launch), the other without one (POST /session). Each uses three wordings: the launch answers of iOS 17 and 26 and of iOS 18, and the session answer of iOS 26 and 27. They also check the one log line;TestLaunchAppGivesUpOnAnAppIOSDoesNotKnow: Code=4 every time, so the launch fails with WDA's error afterlaunchRetryFor;TestLaunchAppDoesNotRetryOtherErrors: any other error is sent once.Related Issues
Fixes #251
Testing
mainand pass with the change. The fourth passes on bothgo vet,gofmt -s -land golangci-lint v2.13.2 (CI's pin, under go1.26.7) report nothinggo test -race ./...passes.pkg/driver/browser/cdpandpkg/emulatorwere left out: they fail on this Mac onmaintoo (Chrome's launch; an emulator holding 5554)--wda-urlwithMAESTRO_RUNNER_IOS_INSTALLER=zipconduit:launchApp: {clearState: true}):mainfailed at the second launch with Code=4. With this change, 15 of 15 launched, 11 of them after one retry, 2.8–3.3 s after the first try;launchApp: {clearState: true}, 8 runs: all passed, 6 of them after one or two retries of/wda/apps/launch(3.4–4.2 s);POST /sessionright after the reinstall got Code=4, then launched on the second try (3.7–6.0 s).make testas a whole: not run, because its device tests drive whatever device is attachedChecklist
Additional Notes
main, the flow runner'sEnsureSessioncreates the session when the flow starts, beforelaunchAppreinstalls. So in most runs the launch after the reinstall is/wda/apps/launch. A session comes after the reinstall whenEnsureSessionfailed, because the app was not installed when the flow began. The last set of runs above is that case.EnsureSessionof such a flow now waits 10 s before it gives up, with one warning line. Before, it gave up at once. ItslaunchAppthen installs the app and goes on as before./wda/apps/launchsays "… is unknown to FrontBoard" on iOS 17 and 26, and "Unknown application display identifier …" on iOS 18. A new session says "Application info provider (FBSApplicationLibrary) returned nil for …" on iOS 26 and 27. All of them areFBSOpenApplicationErrorDomain Code=4(NotFound), which is what the retry matches.