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(gitlab): classify read timeouts as retryable, not a tracked error (#116503)

Tom Owersf20bab5570e7
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/source.py
index 48037d86d3e8..fcc191835d8d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/source.py
@@ -113,7 +113,13 @@ For self-managed GitLab, set the instance URL (for example `https://gitlab.examp
# fetch_page's own 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 GitHub's equivalent case.
- return {"GitLab API error (retryable)"}
+ #
+ # A read timeout that exhausts both the adapter's own retries and fetch_page's tenacity
+ # retry (already covers requests.ReadTimeout/ConnectionError) gets the same treatment — a
+ # slow or unresponsive GitLab instance, not something reconnecting or reconfiguring the
+ # source can fix. Temporal still retries the activity from scratch. Mirrors GitHub's
+ # equivalent classification of the same urllib3 wording.
+ return {"GitLab API error (retryable)", "Read timed out"}
def get_schemas(
self,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/tests/test_gitlab_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/tests/test_gitlab_source.py
index 0695ab92de4a..fe7586145c1e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/tests/test_gitlab_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gitlab/tests/test_gitlab_source.py
@@ -1,3 +1,4 @@
+import pytest
from unittest import mock
from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matches
@@ -16,10 +17,21 @@ class TestGitLabSource:
def test_connection_host_fields(self):
assert self.source.connection_host_fields == ["gitlab_host"]
- def test_transient_5xx_error_is_retryable_not_non_retryable(self):
- # A GitLabRetryableError (any transient upstream 5xx) that exhausts fetch_page's tenacity
- # retry must stay retryable, so a GitLab-side outage doesn't disable the source.
- observed_error = "GitLab API error (retryable): status=502, url=https://gitlab.com/api/v4/projects/1/issues"
+ @pytest.mark.parametrize(
+ "observed_error",
+ [
+ # A GitLabRetryableError (any transient upstream 5xx) that exhausts fetch_page's
+ # tenacity retry must stay retryable, so a GitLab-side outage doesn't disable the source.
+ "GitLab API error (retryable): status=502, url=https://gitlab.com/api/v4/projects/1/issues",
+ # A read timeout that exhausts both the adapter's own retries and fetch_page's tenacity
+ # retry must also stay retryable — a slow/unresponsive GitLab instance, not a credential
+ # or config problem the customer can fix by reconnecting.
+ "HTTPSConnectionPool(host='gitlab.example.com', port=443): Max retries exceeded with url: "
+ '/api/v4/projects/1/issues (Caused by ReadTimeoutError("HTTPSConnectionPool(host='
+ "'gitlab.example.com', port=443): Read timed out. (read timeout=60)\"))",
+ ],
+ )
+ def test_transient_error_is_retryable_not_non_retryable(self, observed_error):
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()