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(plain): classify Plain API read timeouts as retryable (#91779)

Tom Owersbb2901161e09
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
index a9902a1b7583..e3a8d2b2afa3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
@@ -93,6 +93,14 @@ Make sure to grant the following read permissions:
"403 Client Error": "Access forbidden. Grant your Plain API key these read permissions, then reconnect: customer:read, thread:read, timeline:read, user:read, label:read, company:read, machineUser:read.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # Plain's API occasionally takes longer than the 60 s read timeout, which is a transient
+ # blip that Temporal retries at the activity level. Match the host so the pattern is
+ # scoped to Plain and doesn't suppress unrelated timeout messages.
+ return {
+ "HTTPSConnectionPool(host='core-api.uk.plain.com', port=443)",
+ }
+
def get_schemas(
self,
config: PlainSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
index 714f8194fe49..9c810566a772 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
@@ -1,3 +1,4 @@
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matches
from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.plain import PlainSourceConfig
from products.warehouse_sources.backend.temporal.data_imports.sources.plain.settings import ENDPOINTS
from products.warehouse_sources.backend.temporal.data_imports.sources.plain.source import PlainSource
@@ -49,3 +50,7 @@ class TestPlainSource:
schemas = self.source.get_schemas(self.config, self.team_id, names=["nonexistent"])
assert schemas == []
+
+ def test_read_timeout_is_retryable(self):
+ error_msg = "HTTPSConnectionPool(host='core-api.uk.plain.com', port=443): Read timed out. (read timeout=60)"
+ assert error_message_matches(error_msg, self.source.get_retryable_errors())