Skip to content

: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.

fix(github): stop transient upstream 5xx from minting error-tracking issues (#82028)

Tom Owers9549542dfbe9
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.py
index cf963096a2b3..aa5912abcac7 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
@@ -307,7 +307,11 @@ 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.
- return {"GitHub API rate limit exceeded"}
+ #
+ # 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
+ # the source can fix.
+ return {"GitHub API rate limit exceeded", "Github API error (retryable)"}
def get_oauth_accounts(
self, integration_id: int, team_id: int, search: str | None = None
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.py
index 8aeb305ba1f1..723168786912 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
@@ -129,6 +129,15 @@ class TestGithubSource:
retryable_errors = self.source.get_retryable_errors()
assert error_message_matches(observed_error, retryable_errors)
+ def test_transient_5xx_error_is_retryable_not_non_retryable(self):
+ # A GithubRetryableError (any transient upstream 5xx) that exhausts _fetch_page's tenacity
+ # retry must stay retryable, so a GitHub-side outage doesn't disable the source.
+ observed_error = "Github API error (retryable): status=503, url=https://api.github.com/repos/o/r/issues"
+ 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)
+
@pytest.mark.parametrize(
"raised_message,expected_key",
[