fix(ci): add restore-keys and continue-on-error to yarn cache#29277
Merged
Conversation
Add restore-keys fallback to yarn cache so partial key matches can reuse a stale cache instead of forcing a full 610MB re-download on cache miss. Add continue-on-error so a stalled cache download or extraction doesn't fail the entire job — yarn install will run without cache (slower but succeeds). Both patterns already exist in the same file: Bundler cache uses restore-keys (line 272) and CocoaPods cache uses continue-on-error (line 333). This addresses the iOS yarn cache download stall sub-cause of INFRA-3580 (28%, ~18 runs).
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found All E2E tests pre-selected. |
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
Contributor
Author
|
Contributor
Author
|
Ready to review |
jvbriones
approved these changes
Apr 30, 2026
andrepimenta
approved these changes
May 5, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Description
Problem: iOS yarn cache download stalls account for 28% (~18 runs) of the 64 Setup Environment CI failures on
mainover 30 days (Mar 16 – Apr 16, 2026). The 610MB yarn cache downloads at 0.3-2.8 MB/s on Cirrus macOS self-hosted runners (ghcr.io/cirruslabs/macos-runner:tahoe), with tar extraction sometimes hanging for 9+ minutes until the action times out.See INFRA-3580 for the full root cause analysis.
Investigation data:
Examined 6 iOS E2E setup failures from Apr 8-10:
bundle show cocoapodsrepo.yarnpkg.comhung 4.8miniOS E2E full setup timing (Cirrus macOS runners):
iOS setup takes ~2x longer than Android (189-208s vs 103-136s) due to Ruby, Bundler, CocoaPods, and Detox on top of shared steps.
Solution — two changes:
restore-keysfallback — Currently the yarn cache is exact-match only. On cache miss (e.g.,yarn.lockchanged), it triggers a full 610MB re-download. Addingrestore-keyslets yarn reuse a stale cache and only update the diff. Pattern already used by Bundler cache in the same file (line 272).continue-on-error: true— If the cache download or tar extraction stalls, the job currently fails entirely. Withcontinue-on-error, a stalled cache is skipped andyarn install --immutableruns without cache (slower but succeeds). Pattern already used by CocoaPods specs cache in the same file (line 333).Why
restore-keysis safeThe concern: could
restore-keysrestore a stalenode_modulesfrommainwith different package versions?No.
yarn install --immutableguarantees thatnode_moduleswill exactly matchyarn.lockwhen it finishes, regardless of cache state. The cache is just a starting point — yarn adds, removes, or changes whatever is needed to reconcile.--immutableonly preventsyarn.lockmodifications, notnode_modulesupdates.Example: main merges a PR updating package X from v1.0→v1.1. Your PR branch (not rebased) still has X@v1.0 in
yarn.lock.restore-keysrestores main's cache with X@v1.1.yarn install --immutableruns → installs X@v1.0 per your lockfile. Same outcome as a cold install — the lockfile is always the source of truth. Cache only affects speed, not correctness.continue-on-error— needs team inputThis makes the cache step non-blocking. If the 610MB download stalls or tar extraction hangs (actual observed failure: 9.4min hang), the step fails gracefully and
yarn install --immutableruns without cache (slower ~60-90s but succeeds).Pros: stalled cache no longer kills the job;
yarn install --immutablestill produces correctnode_modules; pattern already used by CocoaPods specs cache.Cons: cache failures become silent (job passes but slower); reduces visibility into cache infra problems.
Changelog
CHANGELOG entry: null
Related issues
Fixes: INFRA-3580 (partial — addresses iOS yarn cache download stall sub-cause)
Manual testing steps
Screenshots/Recordings
N/A — CI workflow changes only, no UI impact.
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
CI-only workflow change; it may reduce visibility into cache failures but doesn’t affect runtime code or dependency correctness.
Overview
Improves resilience of the
setup-e2e-envcomposite action’s Yarnnode_modulescache restore.The Yarn cache step now uses
restore-keysto allow partial cache matches whenyarn.lockchanges, and is markedcontinue-on-error: trueso cache download/extraction failures don’t fail the job andyarn install --immutablecan proceed without cache.Reviewed by Cursor Bugbot for commit 2718150. Bugbot is set up for automated code reviews on this repo. Configure here.