Skip to content

fix(github): postpone GraphQL throttling until quota resets - #1148

Open
Tmwakalasya wants to merge 1 commit into
uber:mainfrom
Tmwakalasya:tuntu/fix-github-rate-limit-cooldown
Open

Tmwakalasya wants to merge 1 commit into
uber:mainfrom
Tmwakalasya:tuntu/fix-github-rate-limit-cooldown

Conversation

@Tmwakalasya

Copy link
Copy Markdown
Contributor

Why?

GitHub can report GraphQL throttling inside HTTP 200 responses or as HTTP 403. The change provider and validator currently return those failures as non-retryable, so the consumer rejects the delivery instead of waiting for quota to recover. A local response-fixture reproduction failed for both callers; HTTP 429/503 and permission-error controls behaved as expected.

What?

Preserve recognized GraphQL throttling as a typed error with a retry deadline. Honor Retry-After and, when remaining quota is zero, X-RateLimit-Reset; use the later deadline when both apply. Missing, malformed, or expired deadlines use a one-minute cooldown, following GitHub's guidance.

Register a GitHub classifier in the orchestrator and let the consumer postpone retryable errors carrying the optional errs.RetryDeadline contract. Existing SendRequest callers keep their signature and behavior; an additive helper retains response headers. Ordinary permission failures remain permanent, and explicit permanent classifications still take precedence.

Postponement uses the existing durable queue operation: it resets retry accounting and creates a partition barrier. Repeated throttling can therefore keep a partition waiting indefinitely. Already buffered deliveries and other partitions can still call GitHub; this is not a token-wide rate limiter. REST clients are outside this change. Failed postponement leaves the delivery in flight for visibility-timeout recovery.

Test Plan

  • Regression coverage exercises the public GitHub provider and validator with the production classifier list, including HTTP 200/403 throttling, HTTP 429/503, permission failures, and valid data.
  • Virtual-time tests cover deadline selection, missing/malformed/overflowed/expired headers, wrapped errors, permanent overrides, failed postponement, and successful processing after a cooldown. The consumer test models redelivery; it does not run a real database.
  • Passed Bazel suites for platform/http, the GitHub change provider, and the GitHub validator.
  • Passed race-enabled Bazel suites for platform/githubapi and platform/consumer.
  • Passed the full orchestrator server suite through ./tool/bazel run @rules_go//go -- test -mod=readonly. Its Bazel test target could not build because zlib rejects an absolute Xcode SDKSettings.json include.
  • Passed make fmt, make lint, make check-tidy, make check-gazelle, focused pinned-Go vet, and whitespace checks.
  • Full integration/e2e suites and a live GitHub rate-limit experiment were not run.

Issue

No linked issue. Found while tracing GitHub failure classification.

@Tmwakalasya
Tmwakalasya requested review from a team and sbalabanov as code owners November 29, 2026 18:36

This branch has not been deployed

No deployments
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