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(close): classify exhausted connection retries as noise, not bugs (#81228)

Tom Owers73976d413485
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py
index 05a107053f69..860e04dcf835 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py
@@ -45,6 +45,15 @@ class CloseSource(ResumableSource[CloseSourceConfig, CloseResumeConfig]):
"403 Client Error: Forbidden for url": "Your Close API key does not have access to this resource. Please check the key's permissions.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # Both `CLOSE_RETRY` (Advanced Filtering search) and `DEFAULT_RETRY` (the list endpoints)
+ # already retry a dropped connection or read timeout before re-raising once that budget is
+ # exhausted. urllib3 wraps all of those as "... Max retries exceeded with url: ..."
+ # regardless of the underlying cause (refused connection, read timeout, dropped socket), so
+ # match that stable prefix rather than the per-request URL or nested error detail. Temporal
+ # then retries the whole activity, so the failure is transient and self-recovering.
+ return {"Max retries exceeded with url"}
+
def get_canonical_descriptions(self) -> CanonicalDescriptions:
from products.warehouse_sources.backend.temporal.data_imports.sources.close.canonical_descriptions import (
CANONICAL_DESCRIPTIONS,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py
index 746a1419c2e4..5ca923f397cd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py
@@ -104,6 +104,14 @@ class TestCloseSource:
def test_non_retryable_errors(self, expected_key: str) -> None:
assert expected_key in self.source.get_non_retryable_errors()
+ def test_retryable_errors_match_exhausted_connection_retries(self) -> None:
+ error_msg = (
+ "HTTPSConnectionPool(host='api.close.com', port=443): Max retries exceeded with "
+ 'url: /api/v1/data/search/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='
+ "'api.close.com', port=443): Read timed out. (read timeout=60)\"))"
+ )
+ assert any(pattern in error_msg for pattern in self.source.get_retryable_errors())
+
def test_get_resumable_source_manager_binds_data_class(self) -> None:
inputs = MagicMock()
inputs.logger = MagicMock()