Repository navigation
fix(ci): preinstall + cache the pinned Android NDK; re-time iOS Compile Check - #23084
Conversation
…le Check Two mobile-app-checks infra flakes from 2026-10-21, both failing outside any product code: Android: every Gradle-configuring mobile job (compile-smoke, unit-tests, emulator acceptance) auto-downloaded NDK 28.2.13676358 inside Gradle configure via AGP, which has no retry. A truncated dl.google.com response failed the job with "Error on ZipFile unknown archive" (runs 39506049904, 39469917718, 39626150998; dead 5 s into a download that takes ~22 s when healthy). All three jobs now pin NDK_VERSION in job env (equal to build.gradle's ndkVersion fallback, asserted by test_mobile_ci_infra_guards.py), restore the extracted NDK from one shared actions/cache key, and preinstall through install_android_ndk.py, which verifies the install, purges partial NDK + sdkmanager temp state, and retries once with a 10-minute per-attempt timeout. Only the emulator job saves the cache: it runs in every event the readers do, and compile-smoke keeps post-job saves off the Mobile App Checks wall. On a cache hit the jobs make no NDK request to dl.google.com at all. iOS: the 40-minute job ceiling sat below the measured cold path - 39:25 of real steps plus the ~1 min post-job Post Setup Flutter cache save (run 39634604539 attempt 1) - so a healthy cold job reported cancelled after every real step passed and Mobile Release Eligibility aggregated the failure. The ceiling moves to 50 with the measurements recorded in the workflow comment; the CI budget check counts p50 (19 min, unchanged), not the ceiling. Adds the mobile-ci-infra-guards and mobile-ci-ndk-installer manifest checks covering both guards. The timeout move is registered as a pinned exception in scripts/ci/test_nightly_main_workflow.py (nightly-graph budget guard), which asserts the exact new ceiling so any later drift still fails.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d2d27dd5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
|
|
||
| def run_sdkmanager(sdkmanager: Path, version: str, timeout: float) -> bool: | ||
| command = [str(sdkmanager), f"ndk;{version}"] |
There was a problem hiding this comment.
Pass the selected SDK root to sdkmanager
When --sdkmanager points to a tool from a different SDK than --android-home, this command installs into the SDK containing that tool rather than the directory later checked as ndk_dir; Android documents --sdk_root=path as the way to override that default (sdkmanager options). The verifier therefore reports failure and retries even if installation succeeded elsewhere. Pass the selected Android home via --sdk_root; the current override test misses this because its explicit path equals the inherited ANDROID_HOME.
Useful? React with 👍 / 👎.
…o 50 backend/tests/unit/test_workflow_contracts.py asserts the iOS Compile Check timeout literally; it still said 40 after the ceiling moved to 50 (PR run 39654485678, backend unit shard 1/6). No other test pins the value: the mobile-ci-infra-guards contract and the nightly budget exception already assert 50.
…mpts in 25 min Review round 1 (SHIP, two P2 findings) on #23084: - A per-attempt timeout killed only the cmdline-tools sdkmanager wrapper, not the Java worker it spawns without exec, so a stalled extractor could keep writing into the tree the retry purges. sdkmanager now runs in its own session and the timeout kills the whole process group; the hung- attempt test records the worker's pid and asserts it is gone. - A 600 s per-attempt cap did not fit the 25-minute Android Compile Smoke and JVM ceilings if the first attempt hung (600 s + ~22 s retry + ~20 min body > 25). The cap is 240 s: two attempts cost at most 8 min next to the ~13 / ~9 minute p50 bodies, still ~3 MB/s for a slow CDN day. - sdkmanager receives --sdk_root=<android-home>, so it installs under the root this script verifies and purges even when --android-home diverges from $ANDROID_HOME (tested against a divergent environment). - The writer-covers-readers guard now asserts each reader job's whole `if` is contained in the writer's, not only its event-name literals.
…the NDK Review round 2 (FIX-FIRST, one P2) on #23084: after SIGKILLing the sdkmanager process group, Popen.wait reaps only the wrapper, so the retry's purge could start while a worker was still draining out of the run queue. The timeout path now polls the group with signal 0 (bounded at 10 s) until every member is gone before the purge and retry. The hung-attempt test's fake records whether its non-exec'd worker still exists when the retry invocation starts and asserts it is gone.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b5803eea0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| self.assertTrue( | ||
| pid_is_gone(child_pid), |
There was a problem hiding this comment.
Treat killed zombie workers as terminated
When this newly registered check runs in a container whose PID 1 does not reap orphaned children, the worker is successfully killed but remains a zombie, so os.kill(pid, 0) keeps succeeding and this assertion fails after five seconds. Running python3 .github/scripts/test_install_android_ndk.py for this commit in the provided container reproduced the failure with the worker in Z state; because zombies cannot continue writing, the test should recognize that state as terminated rather than requiring the PID to disappear.
Useful? React with 👍 / 👎.
Summary
Kills the two mobile CI infra flakes from 2026-10-21 (both filed as CI debt on the rollout bus), using existing workflows only — no new workflow.
1. Android: preinstall + cache the pinned NDK (corrupt-download flake)
Every Gradle-configuring mobile job — Android Compile Smoke, Android JVM Unit Tests, Android Emulator Acceptance — auto-downloaded NDK 28.2.13676358 inside Gradle configure via AGP, which has no retry: one truncated dl.google.com response failed the job before any app code ran (
Error on ZipFile unknown archive; runs 39506049904, 39469917718, 39626150998 — dead 5 s into a download that takes ~22 s when healthy; four hits in 48 h).NDK_VERSIONin job env — the same variableapp/android/app/build.gradlealready resolves forndkVersion.${{ runner.os }}-android-ndk-<version>); only the Emulator job saves it (it runs in every event the readers do, and compile-smoke keeps post-job cache saves off the Mobile App Checks wall)..github/scripts/install_android_ndk.py: verifies the install fromsource.properties, purges the partial NDK dir +$ANDROID_HOME/.temp, retries once, 4-minute per-attempt timeout that kills sdkmanager's whole process group (the wrapper does not exec its Java worker), and passes--sdk_rootso sdkmanager writes under the root the script verifies. Two attempts cost at most 8 min, which fits the 25-minute compile-smoke/JVM ceilings next to their ~13/~9 min p50 bodies.2. iOS Compile Check: ceiling 40 → 50 (post-job cache save was cancelled)
Run 39634604539 attempt 1 (PR #23068): real steps finished at 39:25 (16:12 manifest checks + 16:27 Xcode build, cold), then the post-job
Post Setup Fluttercache save (59 s measured on the sibling success run 119312386446) hit the 40-min ceiling. The job reported cancelled after every real step passed, and Mobile Release Eligibility aggregated it as a failure. 50 keeps the wedge-guard above that measured cold path. The CI budget check counts p50 (19 min, unchanged), not the ceiling —check_ci_budgetpasses unchanged.3. Contract tests (two new manifest checks)
mobile-ci-infra-guards— workflow invariants: the NDK pin equals build.gradle'sndkVersionfallback in all three jobs; exactly one NDK cache step per job under the shared key; exactly one cache writer whose event set covers every reader's; the installer invoked through an explicitpython3; the iOS ceiling stays at 50.mobile-ci-ndk-installer— installer behavior against a fake sdkmanager: present → skip; first-attempt success never retries and pins--sdk_root; corrupt first attempt is purged and retried once; double failure exits nonzero; a stale revision is not "installed"; a hung attempt has its whole process group killed (the fake's non-exec'd worker pid is proven dead) and recovers on retry; missingANDROID_HOMEis a usage error;--android-homewins over a divergent$ANDROID_HOME.Product invariants affected
None — CI configuration, one CI helper script, and contract tests under
.github/only. No product path changes.Failure class
Failure-Class: FC-gate-timeout-below-cold-cost
The iOS fix is exactly this class's contract: a fixed time budget must exceed the worst-case healthy cold cost, and the static timing-contract test (
mobile-ci-infra-guardsasserts the 50-min ceiling) keeps the value from silently regressing below the cold path again.Verification (this worktree, base aa7e1d6)
run_checks.py --lane local— 8/8:mobile-ci-infra-guards4/4,mobile-ci-ndk-installer8/8,deferred-work-markers,workflow-checkout-stall-bounds,workflow-apt-network-bounds,ci-budget("CI budget check passed"),main-push-ci-economy-contract7/7,desktop-swift-ci-contract52/52.test_check_ci_budget12/12; manifest validation viarun_checks(both new entries SELECTED).actionlintonmobile-app-checks.yml: clean.Notes