: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(intercom): treat companies scroll cursor expiry as retryable (#72841)
Tom Owers99546f28bcf0
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.pyindex 57418ad423aa..a8137f2744f3 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@@ -63,6 +63,15 @@ class IntercomSource(SimpleSource[IntercomSourceConfig], OAuthMixin):"Intercom access token not found": "Intercom OAuth access token is missing. Please reconnect your Intercom account.",}+ def get_retryable_errors(self) -> set[str]:+ # The `companies` table walks Intercom's companies Scroll API (`_iter_companies` in+ # intercom.py). The scroll cursor expires mid-walk on idle timeout or when a+ # concurrent sync steals the workspace's single scroll slot, and the continuation+ # then 404s (see `_is_scroll_expired`). `companies` is full-refresh, so a fresh+ # Temporal attempt opens a new scroll and restarts cleanly — transient and+ # self-recovering, not a real bug.+ return {"Not Found for url: https://api.intercom.io/companies/scroll"}+@propertydef get_source_config(self) -> SourceConfig:return SourceConfig(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.pyindex b89d7753cc98..0a77732fde68 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@@ -62,6 +62,21 @@ class TestIntercomSource:non_retryable_errors = self.source.get_non_retryable_errors()assert any(key in error_msg for key in non_retryable_errors)+ @pytest.mark.parametrize(+ "error_msg",+ [+ "404 Client Error: Not Found for url: https://api.intercom.io/companies/scroll?scroll_param=c77e46e6-6344-4ada-a0c7-fba26d6af725",+ "404 Client Error: Not Found for url: https://api.intercom.io/companies/scroll",+ ],+ )+ def test_companies_scroll_expiry_is_retryable(self, error_msg):+ # A companies scroll cursor expiring mid-walk (idle timeout, or a concurrent sync+ # stealing the workspace's single scroll slot) 404s on continuation. `companies` is+ # full-refresh, so a fresh Temporal attempt restarts cleanly — this should stay out+ # of error tracking as noise rather than be flagged as a real failure.+ 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)