Skip to content

Deploys backfill: resume from a saved page, pause on rate limits, finish with named failures - #497

Merged
nambok merged 2 commits into
mainfrom
deploys-backfill-resume
Nov 6, 2026
Merged

nambok merged 2 commits into
mainfrom
deploys-backfill-resume

Conversation

@nambok

@nambok nambok commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Earlier deploys stopped at "Counting..." on large repos: a pass that ran out of time restarted the repo from scratch, rate limits counted as failures, one failing repo blocked the team, and repeated page loads started parallel reads.

Changes

  • Each repo read saves its place after every page; the next pass continues there
  • Busy ranges over 1,000 runs are split until they fit
  • Runs are checked for being a possible deploy before any extra GitHub call; tag lookups cached per ref
  • Rate limits pause and requeue with GitHub's delay; never a failure
  • A repo that fails 3 passes is set aside with its reason; the team finishes
  • One read per team at a time (lease)
  • Analytics returns progress (repos read of total) and repos not read
  • A rate-limited webhook deploy is requeued instead of dropped

Verification

cargo fmt, clippy -D warnings and cargo test for common, gateway and worker pass; new tests for resume, no-request filtering, rate-limit pause and bounded failures.

…ish with named failures

Analytics could show "Counting earlier deploys" for hours and never finish.

- Each repository saves where its read stands (range and page) after every
  page; a pass that runs out of time continues from that page instead of
  from the first week. A range with more runs than GitHub lists is halved.
- A run is checked against everything known without a request first (who
  started it, the deploy workflows setting, its name and file, its
  workflow's jobs read once per file); only a possible deploy costs the tag
  lookup (once per ref) and its jobs read.
- GitHub's rate limit (429, or 403 with no requests left or a rate limit
  message) is a typed error carrying the wait GitHub asked for; the
  backfill saves progress and queues itself after that wait instead of
  failing. A webhook's run waits it out the same way, a few times.
- A repository that fails three passes in a row without reading a page is
  named as not read, with why, and the team is marked done. Failing ones
  are retried by the backfill itself after two minutes, not on the next
  page load an hour later.
- One pass reads per team (a lease on the progress item), so page loads
  never start parallel chains.
- The progress item records repositories read of all; analytics returns it
  as deploys_backfill_progress, and the repositories given up on as
  deploys_not_read.
…setup checks say a rate limit is a rate limit

On one install the backfill used up the installation's hourly GitHub
budget in 14 minutes, and for an hour after that every live job failed:
reviews, mark ready, run tools, the code graph index. Pausing on a 403 is
too late.

- Every response made with an installation token records its core budget
  (x-ratelimit-remaining, -limit, -reset), successes included, per
  installation, in this process.
- The backfill spends only while at least half that budget is left. Below
  half, at the start of a pass or before any page, it saves its cursor and
  waits for the reset, as for a rate limit.
- A pass makes at most 1,000 requests, then continues five minutes later.
- Tests setup: a rate limit on any read now says GitHub's hourly limit for
  Coderhelm is used up, when it resets, and to try again then. Only a 404
  on the repository says the app can't see it; other refusals say what
  GitHub answered. A rate limit while reading files is an error, never "no
  workflow".
@nambok
nambok merged commit 260634e into main Nov 6, 2026
10 checks passed
@nambok
nambok deleted the deploys-backfill-resume branch November 6, 2026 21:07
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