Skip to content

🔁 fix: Retry the Alias Transition Before Skipping a Cache Purge - #744

Merged
berry-13 merged 4 commits into
mainfrom
berry-13/poisoned-docs
Sep 2, 2026
Merged

berry-13 merged 4 commits into
mainfrom
berry-13/poisoned-docs

Conversation

@berry-13

@berry-13 berry-13 commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #742. Its first production purge failed during Vercel's alias transition.

  • Retry fresh 404s and cross-shell build disagreement up to 5 times with linear backoff.
  • Drain every active probe worker before another discovery attempt starts.
  • Retry only transition-compatible HTTP responses; permanent 401/403 responses fail immediately.
  • Require every no-runtime shell to expose a Skew Protection deployment identity.
  • Support both Webpack runtime maps and /_next/static/immutable/** deployments.
  • On discovery failure, union broad page and public-asset recovery targets into the original diff and suppress the successful purge marker.

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_status purge for #742's merge commit, failed at Collect current build assets:

::error::Fresh Webpack runtime probe failed for
  https://www.librechat.ai/_next/static/chunks/webpack-d866b33691ef39b9.js: HTTP 404

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, Purge was 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/static requests return 404 with cf-cache-status: BYPASS, not HIT.

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.
  • Workflow YAML parsed with PyYAML; every embedded run block passed bash -n.
  • Earlier live smoke run of node scripts/cache-build-assets.mjs against production completed with 96 assets from 21 shells.

Checklist

  • Tests cover retry boundaries, worker draining, status classification, shell identity, and degraded recovery.
  • Lint, format, and typecheck pass.
  • No user-facing content or UI changes.

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.
@vercel

vercel Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
librechat-ai Ready Ready Preview Sep 1, 2026 5:41pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T17:32:23.001057Z f04952e New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread .github/workflows/cache-purge.yml
Comment thread scripts/cache-build-assets.mjs
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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread scripts/cache-build-assets.mjs
Comment thread scripts/cache-build-assets.mjs Outdated
Comment thread scripts/cache-build-assets.mjs
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

1 similar comment
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@berry-13
berry-13 disabled the stack merge September 2, 2026 13:41
@berry-13
berry-13 merged commit 3ff259b into main Sep 2, 2026
6 checks passed
@berry-13
berry-13 deleted the berry-13/poisoned-docs branch September 2, 2026 13:43

This branch was successfully deployed

1 active deployment
Preview — 293945c7 Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant