:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(warehouse-sources): retry github graphql rate limits (#130602)
Tom Owers8231dbfbe5e7
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.pyindex 1c5e9aae8d8d..005654ca8ca9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/source.py@@ -473,6 +473,9 @@ If automatic creation failed with a permissions error, the fix depends on how yo# A GitHubRateLimitError that survives _fetch_page's own rate-limit-aware tenacity retry# still gets picked up by Temporal's activity retry; classify it as retryable so it's# logged as a warning rather than tracked as an exception. Mirrors Stripe's equivalent case.+ # GraphQL's own primary rate limit (_raise_if_graphql_rate_limited, hit while backfilling+ # pull_requests.merge_commit_sha) raises the same exception type with different wording, so+ # it needs its own entry here rather than falling through to the generic exception path.## A GithubRetryableError (any transient upstream 5xx) that survives the same tenacity retry# gets the same treatment — a GitHub-side outage, not something reconnecting or reconfiguring@@ -493,6 +496,7 @@ If automatic creation failed with a permissions error, the fix depends on how yo# self-healing condition at the top of the pipeline-error groups.return {"GitHub API rate limit exceeded",+ "GraphQL rate limit exceeded","GitHub egress budget exhausted","Github API error (retryable)","UNEXPECTED_EOF_WHILE_READING",@@ -506,6 +510,7 @@ If automatic creation failed with a permissions error, the fix depends on how yoreturn {"GitHub egress budget exhausted": RATE_LIMITED_MESSAGE,"GitHub API rate limit exceeded": RATE_LIMITED_MESSAGE,+ "GraphQL rate limit exceeded": RATE_LIMITED_MESSAGE,}def get_oauth_accounts(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_source_class.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_source_class.pyindex a5568deb3ee5..ec680145046c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_source_class.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_source_class.py@@ -144,6 +144,16 @@ class TestGithubSource:retryable_errors = self.source.get_retryable_errors()assert error_message_matches(observed_error, retryable_errors)+ def test_graphql_rate_limit_error_is_retryable_not_non_retryable(self):+ # GraphQL's own primary rate limit (_raise_if_graphql_rate_limited) raises the same+ # GitHubRateLimitError type as the REST limit above, but with different wording, so it+ # needs its own entry to avoid falling through to the generic exception path.+ observed_error = "Github GraphQL rate limit exceeded (resets at 1786360951)"+ non_retryable_errors = self.source.get_non_retryable_errors()+ assert not any(key in observed_error for key in non_retryable_errors)+ retryable_errors = self.source.get_retryable_errors()+ assert error_message_matches(observed_error, retryable_errors)+def test_egress_budget_exhausted_is_retryable_not_non_retryable(self):# Our own limiter shedding a deferrable call is the twin of GitHub's rate limit above, and# must be classified the same way: tracking it as an exception put a self-inflicted,