🔁 fix: Retry the Alias Transition Before Skipping a Cache Purge - #744
Conversation
Asset discovery treated a 404 from an in-flight Vercel alias swap as fatal, so the first automatic purge after live discovery shipped aborted without issuing a single Cloudflare call, and the new build's assets kept their poisoned edge entries in whichever locations had cached the 404. Retry the two observable symptoms of a transition, a probe 404 and page shells that disagree about the Webpack runtime, and let a run that still cannot enumerate assets purge its recovery targets rather than nothing. A degraded run records no purge marker, so the next deploy re-purges its range instead of stepping over it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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. |
📦 Next.js Bundle Analysis for librechat.aiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7070d056b9
ℹ️ 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".
Builds of this project can serve /_next/static/immutable/** with no webpack-*.js runtime chunk, which discovery treated as a hard failure and which would therefore stop every asset purge. Fall back to the eagerly referenced shell assets, and warn that the lazy-chunk map could not be expanded so the coverage loss is visible in the run. Identify which build rendered a shell by the Skew Protection deployment id when Next.js publishes one, falling back to the runtime chunk name. The deployment id works in either asset layout, so transition detection no longer depends on webpack output. Verified against both live layouts: 105 assets from production, 78 from an immutable-layout preview deployment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2503052992
ℹ️ 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".
📦 Next.js Bundle Analysis for librechat.aiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
📦 Next.js Bundle Analysis for librechat.aiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
1 similar comment
📦 Next.js Bundle Analysis for librechat.aiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Summary
Follow-up to #742. Its first production purge failed during Vercel's alias transition.
/_next/static/immutable/**deployments.Stacked follow-up #745 migrates the automatic trigger to Vercel's enriched promotion event and removes build-asset probes from normal deployments.
Root cause
Run 33258912546, the
deployment_statuspurge for #742's merge commit, failed atCollect current build assets:A shell fetched 15 seconds after Vercel reported ready still came from the old deployment, whose runtime the alias had stopped serving. The step exited 1,
Purgewas skipped, and the newly deployed assets kept the poisoned edge entries reported in discussion 15331. Production stayed broken in eastern North America until manual run 33525780255 purged 27 prefixes and 120 URLs.The Cloudflare rule that retained those 404s for a month now applies no-store to status
>= 400. Repeated missing/_next/staticrequests return 404 withcf-cache-status: BYPASS, notHIT.Change Type
Bug fix (non-breaking).
Testing
pnpm test: 391 tests across 33 files on this branch.pnpm typecheck.npx eslint scripts/cache-build-assets.mjs scripts/cache-build-assets.test.ts scripts/cache-purge-prefixes.test.ts.npx prettier --check .github/workflows/cache-purge.yml scripts/cache-build-assets.mjs scripts/cache-build-assets.test.ts scripts/cache-purge-prefixes.test.ts.runblock passedbash -n.node scripts/cache-build-assets.mjsagainst production completed with 96 assets from 21 shells.Checklist