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(intercom): classify transient 5xx errors as retryable (#109481)

Tom Owers8974f82a33bd
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
index 498fcd5ad209..c20d4b6b219b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
@@ -75,6 +75,14 @@ class IntercomSource(SimpleSource[IntercomSourceConfig], OAuthMixin):
return {
"Not Found for url: https://api.intercom.io/companies/scroll",
"Bad Request for url: https://api.intercom.io/companies/scroll",
+ # Every Intercom request goes through `_make_intercom_session`, whose transport-level
+ # retry (`_INTERCOM_RETRY`, derived from `DEFAULT_RETRY`) already retries a 429/5xx
+ # response before `raise_for_status` can raise. A `HTTPError` reaching here has already
+ # exhausted that budget, so it's a transient upstream blip — Temporal retries the whole
+ # activity next. `raise_for_status` derives the "Server Error" prefix from the status
+ # code alone, not Intercom's reason text, so it's stable to match on (see
+ # convex/app_store_connect for the same pattern).
+ "Server Error",
}
@property
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom_source.py
index 8ddc7162bf98..6cfa1e7108af 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom_source.py
@@ -88,6 +88,21 @@ class TestIntercomSource:
retryable_errors = self.source.get_retryable_errors()
assert any(key in error_msg for key in retryable_errors)
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ "503 Server Error: Service Temporarily Unavailable for url: https://api.intercom.io/conversations/1",
+ "500 Server Error: Internal Server Error for url: https://api.intercom.io/contacts",
+ ],
+ )
+ def test_transient_server_error_is_retryable(self, error_msg):
+ # Every Intercom call already retries a 429/5xx at the transport level
+ # (`_INTERCOM_RETRY`) before `raise_for_status` can raise, so a `HTTPError` reaching here
+ # has exhausted that budget — a transient blip, not a bug. Temporal retries the whole
+ # activity next, so this should stay out of error tracking as noise.
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in error_msg for key in retryable_errors)
+
def test_get_schemas_covers_all_endpoints(self):
schemas = self.source.get_schemas(self.config, self.team_id)