: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(github): treat SSL EOF during token refresh as retryable (#99828)
Tom Owersfd8e502d1adc
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 4675f49db69e..ff27b1018631 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@@ -369,7 +369,20 @@ If automatic creation failed with a permissions error, the fix depends on how yo# 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)"}+ #+ # A TLS session cut at the socket while minting the installation access token+ # (``GitHubIntegrationBase.client_request``, called from ``_get_access_token``) has no+ # in-process retry of its own — unlike ``_fetch_page``'s data requests, whose tenacity retry+ # already covers ``requests.ConnectionError`` (the base class ``SSLError`` subclasses).+ # Either way it's a dropped connection, not a GitHub or customer problem, so once Temporal+ # retries the activity the failure is transient and self-recovering. Mirrors ClickHouse's+ # equivalent classification of the same urllib3/OpenSSL wording.+ return {+ "GitHub API rate limit exceeded",+ "Github API error (retryable)",+ "UNEXPECTED_EOF_WHILE_READING",+ "EOF occurred in violation of protocol",+ }def get_oauth_accounts(self, integration_id: int, team_id: int, search: str | None = Nonediff --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 83981ada37d6..73ca2648d341 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@@ -148,6 +148,20 @@ class TestGithubSource:retryable_errors = self.source.get_retryable_errors()assert error_message_matches(observed_error, retryable_errors)+ def test_ssl_eof_error_is_retryable_not_non_retryable(self):+ # A TLS session cut at the socket while minting the installation access token+ # (client_request has no in-process retry, unlike _fetch_page). Must stay retryable so a+ # dropped connection to GitHub doesn't disable the source.+ observed_error = (+ "HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: "+ "/app/installations/123/access_tokens (Caused by SSLError(SSLEOFError(8, "+ "'[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1032)')))"+ )+ 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",[