Repository navigation
ci(playwright): survive registry 5xx — yarn restore-keys fallback + retry - #31730
Merged
Merged
Conversation
…etry Run 32222855561's plan-playwright died on a single upstream blip: error https://registry.yarnpkg.com/regenerator-runtime/-/regenerator- runtime-0.14.1.tgz: Request failed "502 Bad Gateway" Two defects compounded: 1. setup-node's built-in `cache: yarn` is exact-key only. The queue batch changed yarn.lock, the key missed with no fallback ("yarn cache is not found"), and yarn cold-fetched all ~2000 tarballs from the registry — maximizing the surface for any single 5xx. yarn v1 does not retry HTTP errors on tarball downloads, so one 502 killed the whole plan job and ejected the queue entry. 2. No retry anywhere around `yarn install`, the last infra dependency in the playwright pipeline without one (docker pulls retry since #30826; apt is cached + gated since #31691/#31718). Fixes, applied to all four install call sites (plan-playwright, prepare-playwright-fixture, playwright-ci, slack-notify): * Replace setup-node's cache with an explicit actions/cache on ~/.cache/yarn keyed on the lockfile hash WITH a restore-keys fallback. A lockfile change now restores the previous cache and yarn fetches only the delta — a handful of tarballs instead of the world. * Wrap `yarn --ignore-scripts --frozen-lockfile` in a 3-attempt retry (15 s / 30 s backoff, `--network-timeout 100000`). The idiom is verified safe under the runner's `bash -e`. Also in plan-playwright: mark the two browser-cache seeding steps `continue-on-error`. They exist to populate the run-scoped browser cache once for all downstream shards (not for `--list`, which never launches a browser) — a seeding failure should degrade to shards self-installing, not fail planning. Comment updated to document the seeding role explicitly. `id: setup-node` / `id: install-dependencies` outcome wiring in the shard job is preserved. Follow-up (separate PR): cache the discovery output itself (playwright-test-list.json keyed on the playwright tree + config + mode flags) so plan-playwright skips install + discovery entirely on the hot path. Co-Authored-By: Claude Fable 5 <[email protected]>
chirag-madlani
requested review from
ShaileshParmar11 and
karanh37
as code owners
August 19, 2026 06:57
Contributor
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedAdds explicit yarn cache with restore-keys fallback and 3-attempt retry logic across Playwright CI workflows to survive registry 5xx errors. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
ShaileshParmar11
approved these changes
Aug 19, 2026
3 of 5 tasks
chirag-madlani
added a commit
that referenced
this pull request
Aug 19, 2026
…ies survivable (#31746) * ci(playwright): break the cache-eviction death spiral + make apt retries survivable Diagnosis of runs 32223093113 and 32233411840 exposed three compounding defects that no amount of per-symptom patching was going to fix: 1. CACHE-EVICTION DEATH SPIRAL. The repo cache store measured 17.5 GB against a 10 GB LRU budget, with 49 of 50 caches on ephemeral refs (merge-queue branches, PR merge refs). The explicit yarn cache from #31730 was the biggest single source — on an ephemeral ref the exact key can never pre-exist, so every job saved a fresh ~700 MB duplicate (9 copies = 6.4 GB observed) even when restore-keys had restored content perfectly. Those saves evicted every main-scoped cache within ~30 minutes of creation (the #31718 apt cache created 06:15 was gone before 06:49), which turned downstream "cache hits" into cold fetches against apt mirrors / registry.yarnpkg.com / the Playwright CDN — and a bad day on any of those took the whole matrix down. More misses meant more ephemeral saves, feeding back into more eviction. Fix: every yarn and browser cache step in the reusable workflow is now RESTORE-ONLY (actions/cache/restore@v5) — ephemeral refs never save. The one writer is populate-playwright-apt-cache.yml, which runs on main and now warms all three caches (yarn, browser, apt), on the 6 h schedule, on dispatch, and on pushes to main touching yarn.lock / .nvmrc / the workflows. The plan job's run-scoped browser seeder is deliberately kept save-capable for lockfile-change entries; once eviction stops it no-ops on hit. Projected steady state ~6-8 GB, under budget, no evictions. 2. USELESS INSTALL RETRY. `timeout --signal=TERM ... npx playwright install-deps` only signals the direct child; the underlying apt-get survives and keeps holding /var/lib/apt/lists/lock. Run 32233411840 showed the exact sequence: apt had failed over from the dead Azure mirror to archive.ubuntu.com and was slowly succeeding, the 8-minute ceiling killed the wrapper mid-download, and the retry then died instantly on "Could not get lock ... held by process 15226". The same stale lock can be left by a timed-out cache-apt-pkgs action earlier in the job. Fix: a reap_apt() helper (killall -9 apt/apt-get/dpkg, remove stale lock files, dpkg --configure -a) runs BEFORE the first attempt and between attempts at both install-deps call sites. The shard job's single-attempt install gains the same one-retry loop the fixture builder already had. This adopts the diagnosis from PR #31737 at the location where it can actually work — the stale lock is created by our own timed-out first attempt, so clearing locks before the cache action (as #31737 does) runs too early to help. 3. POPULATE WORKFLOW TOO NARROW. It only warmed the apt cache; the yarn and browser caches had no main-scoped writer at all, so their first miss on any ephemeral ref started the duplicate-save churn. Verified: YAML valid on both files; all 6 yarn/browser cache steps in the reusable workflow audited restore-only; the reap+retry idiom tested under bash -e; the plan-job seeder confirmed retained. Co-Authored-By: Claude Fable 5 <[email protected]> * address greptile P1 — make the cache warmers independent The populate job ran its warmers sequentially with fail-fast semantics: a yarn-registry outage surviving all three retries (or a Chromium CDN failure) killed the job BEFORE the apt writer ran — blocking the refresh of the one cache whose absence takes down whole matrices, which is exactly the failure this workflow exists to prevent. Restructured: * apt populate runs FIRST (no node/yarn dependency) and continue-on-error, so nothing can starve it and its own failure cannot starve the others. * yarn and browser warmers are continue-on-error with explicit restore/save pairs; each save is gated on its warmer SUCCEEDING. The gating also fixes a latent bug a bare continue-on-error would have introduced: actions/cache's post-job save runs when the job succeeds, so a failed yarn install would have permanently baked a partial ~/.cache/yarn under the exact lockfile key (actions/cache never overwrites an existing key). * the browser warmer is additionally gated on the yarn warmer succeeding — npx resolves the pinned @playwright/test from the local install. * a final "Report warm failures" step fails the job if ANY warmer failed — full signal on schedule/dispatch, but only after every cache had its chance to refresh. Verified: YAML valid; apt package list + version still byte-identical to both reusable-workflow call sites; yarn/browser keys match the restore-only steps. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
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
Run 32222855561's
plan-playwrightdied on one upstream blip:Two compounding defects
1. Exact-key-only yarn caching.
actions/setup-node's built-incache: yarnhas norestore-keys. The queue batch changedyarn.lock→ new hash → completely cold cache (yarn cache is not foundin the log) → yarn cold-fetched all ~2000 tarballs, maximizing exposure to any single 5xx.2. No retry. yarn v1 does not retry HTTP errors on tarball downloads — one 502 killed the plan job and ejected the queue entry. This was the last infra dependency in the pipeline without a retry (docker pulls: #30826; apt: cached + gated via #31691/#31718).
Changes (all four install call sites: plan-playwright, prepare-playwright-fixture, playwright-ci, slack-notify)
actions/cacheon~/.cache/yarnkeyed on the lockfile hash withrestore-keysfallback — a lockfile change now restores the previous cache and fetches only the delta (a handful of tarballs instead of ~2000). Replaces setup-node's built-in caching.yarn --ignore-scripts --frozen-lockfile(15 s / 30 s backoff,--network-timeout 100000). Idiom verified safe under the runner'sbash -e.Bonus: plan-playwright browser seeding made non-fatal
During investigation I initially flagged the plan job's Chromium install as dead weight (
--listnever launches a browser) — that read was wrong. The step seeds the run-scoped browser cache once so 30+ downstream shards don't each download ~250 MB on a lockfile change. Kept it, but marked both seeding stepscontinue-on-errorso a CDN failure degrades to shards self-installing instead of failing planning. Comment now documents the seeding role explicitly.id: setup-node/id: install-dependenciesoutcome wiring in the shard job is preserved.Test plan
bash -esemantics (thecmd && breaklist does not trip errexit).cache: yarnusages (the one string match left is inside a comment).Restore yarn package cachelogs a restore-keys fallback hit; install fetches only the delta.Follow-up (separate PR)
Cache the discovery output itself —
playwright-test-list.jsonis a pure function of theplaywright/tree + config + mode flags; on a key hit,plan-playwrightcan skip install and discovery entirely (~30 s job, zero registry traffic).Related: #30826 (docker retry), #31691 (apt gate), #31718 (main-scoped apt cache).
🤖 Generated with Claude Code
Greptile Summary
This PR makes Playwright dependency installation more resilient to transient registry failures.
Confidence Score: 5/5
The PR appears safe to merge with no actionable defects identified in the changed workflow behavior.
The new cache steps target the Yarn Classic default cache, retries retain frozen-lockfile failure semantics, and downstream jobs retain unconditional Chromium installation when plan-stage seeding fails.
Important Files Changed
Reviews (1): Last reviewed commit: "ci(playwright): survive registry 5xx — y..." | Re-trigger Greptile