ci(android): un-flake the emulator integration-test job - #251
Merged
ddfreiling merged 1 commit intoSep 22, 2026
Merged
Conversation
android-emulator-runner presses the unlock key the instant `sys.boot_completed` reads 1, with no hook in between. A restored quickboot snapshot sets that property before its services are back, so the keypress is killed (exit 137) and the step dies before our `script:` ever runs. Roughly one API 24 job in five over the last 60 CI runs; API 36 is unaffected. Upstream fix is open but unmerged (ReactiveCircus/android-emulator-runner#489). Two guards. The AVD-snapshot step now idles before teardown, so the cached snapshot captures a settled system instead of one mid-startup. And the test step retries once, but only when `android-test-api<N>.log` is absent — a missing log proves the suite never started, while a real test failure always leaves its log and must stand. Both attempts call a new shared composite action so the two paths cannot drift. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
The API 24 emulator job fails about one run in five, and it is not a boot failure — the emulator boots fine.
reactivecircus/android-emulator-runnerpresses the unlock key the instantsys.boot_completedreads1, with no hook in between:A restored quickboot snapshot sets that property before its services are back, so the keypress is killed (exit 137) and the step dies before our
script:runs — which is also why the failed runs upload no diagnostics. Upstream issue #489 is open; the fix (#495) is unmerged, so bumping the action does not help.Signature, identical across every affected run:
Survey of the last 60 CI runs:
Fix
A sleep cannot be inserted where it is needed — the action exposes only
pre-emulator-launch-script(before launch) andscript(after the keypress). So, two guards instead:script: sleep 60) before teardown, so the cached snapshot captures a system that has finished starting rather than one mid-startup. Only runs on a cache miss.Run integration testsiscontinue-on-error, and retries once only whenandroid-test-api<N>.logis absent. A missing log proves the suite never started; a real test failure always leaves its log behind and is never re-run.Both attempts call a new shared composite action,
.github/actions/run-android-integration-tests, so the two paths cannot drift. The AVD cache key now hashes that file too.Verification
actionlintclean; both YAML files parse.flutter testone-liner moved byte-identical (diffed), apart frommatrix.→inputs..Not verified: this has not run in CI yet. The retry logic is sound on paper; the settle sleep is well-reasoned but unproven — the failure is intermittent, so a single green run will not confirm it either. Worth watching the API 24 job over the next couple of weeks.
No
CHANGELOG.mdentry: CI-only, nothing a consumer upgrading the package would notice.🤖 Generated with Claude Code