Skip to content

ci(playwright): survive registry 5xx — yarn restore-keys fallback + retry - #31730

Merged
chirag-madlani merged 1 commit into
mainfrom
ci/plan-yarn-resilience
Aug 19, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
ci/plan-yarn-resilience

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Run 32222855561's plan-playwright died on one upstream blip:

error https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz:
Request failed "502 Bad Gateway"

Two compounding defects

1. Exact-key-only yarn caching. actions/setup-node's built-in cache: yarn has no restore-keys. The queue batch changed yarn.lock → new hash → completely cold cache (yarn cache is not found in 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)

  • Explicit actions/cache on ~/.cache/yarn keyed on the lockfile hash with restore-keys fallback — 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.
  • 3-attempt retry around yarn --ignore-scripts --frozen-lockfile (15 s / 30 s backoff, --network-timeout 100000). Idiom verified safe under the runner's bash -e.

Bonus: plan-playwright browser seeding made non-fatal

During investigation I initially flagged the plan job's Chromium install as dead weight (--list never 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 steps continue-on-error so a CDN failure degrades to shards self-installing instead of failing planning. Comment now documents the seeding role explicitly.

id: setup-node / id: install-dependencies outcome wiring in the shard job is preserved.

Test plan

  • YAML validated.
  • Retry idiom verified under bash -e semantics (the cmd && break list does not trip errexit).
  • Grep-verified: 4 cache steps with restore-keys, 4 retry loops, 0 remaining cache: yarn usages (the one string match left is inside a comment).
  • Next run with a yarn.lock change: Restore yarn package cache logs a restore-keys fallback hit; install fetches only the delta.
  • Any registry 502 mid-install: warning annotation + retry instead of job failure.

Follow-up (separate PR)

Cache the discovery output itself — playwright-test-list.json is a pure function of the playwright/ tree + config + mode flags; on a key hit, plan-playwright can 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.

  • Replaces setup-node’s exact-key Yarn caching with explicit caches that support restore-key fallback.
  • Retries Yarn installation up to three times with increasing delays and a network timeout.
  • Makes plan-stage browser-cache seeding non-fatal so downstream shards can install Chromium themselves.

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

Filename Overview
.github/workflows/playwright-e2e-reusable.yml Adds consistent Yarn cache fallback and bounded install retries across four jobs while preserving downstream browser-install fallback behavior.

Reviews (1): Last reviewed commit: "ci(playwright): survive registry 5xx — y..." | Re-trigger Greptile

…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]>
Copilot AI lite review requested due to automatic review settings August 19, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 19, 2026
@gitar-bot

gitar-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds explicit yarn cache with restore-keys fallback and 3-attempt retry logic across Playwright CI workflows to survive registry 5xx errors. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@chirag-madlani
chirag-madlani merged commit ac4939f into main Aug 19, 2026
73 of 76 checks passed
@chirag-madlani
chirag-madlani deleted the ci/plan-yarn-resilience branch August 19, 2026 07:25
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants