Fail the build on persistent HF rate limiting#12
Draft
gary149 wants to merge 2 commits into
Draft
Conversation
Add hfFetch: an authenticated HF API fetch that retries on 429/5xx and throws if throttling persists. Route the models query and both author overview lookups through it, and drop the swallowing try/catch in load so a throttled prerender fails the build instead of silently baking empty pages. A failed build skips the deploy step, so prod keeps the last successful site. Genuine 200-with-no-results still builds fine.
julien-c
reviewed
May 30, 2026
Contributor
julien-c
left a comment
There was a problem hiding this comment.
imo setting a HF_TOKEN like you've done should already solve it
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.
Problem
The site is fully prerendered (
adapter-static) and deploys to GitHub Pages. Model pages fetch quant/author data from the HF API at build time. Until now, every HF failure path ended in a green build with empty data:res.okfalse ->repos: []fetchAuthorInforeturnsnull-> repos filtered outtry/catch->repos: []So if the CI
HF_TOKENever expires, or HF throttles, the deploy silently overwrites the live site with blank pages, with a green check and no alert. This is exactly the original incident (unauthenticated calls hit the rate limit and pages built empty).Change
Add
hfFetch, an authenticated HF API fetch that retries on 429/5xx (3 attempts, 1s/2s/3s backoff) and throws if throttling persists. Route the models query and both author-overview lookups through it, and remove the swallowingtry/catchinload. A persistent throttle now throws out ofload, which fails the prerender andvite build.Because the deploy workflow runs
npm run buildbefore the Upload/Deploy steps (noif: always()), a failed build skips deploy entirely, so GitHub Pages keeps serving the last successful deployment. A genuine 200 with no results still builds fine, so there is no false alarm on a model that legitimately has no quants.Behavior
Verification
HF_TOKEN=... npm run build): exits 0, all 6 pages populated (Qwen3.6-27B 6, Qwen3.6-35B-A3B 6, gemma-4-26B-A4B 5, Gemma-4-E4B 5, gpt-oss-20b 6, Step-3.7-Flash 2).hfFetchthrow;npm run buildexited 1 withError: 500 /models/...and did not write the site, confirming a throttle fails the build instead of shipping blanks. Reverted afterwards.npm run check,prettier --check, andnpm run test:unitall pass.Depends on the
HF_TOKENrepo secret (already configured). No workflow change needed.