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(warehouse-sources): retry temporalio generic transport errors (#116484)

Tom Owersefad634355a4
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py
index 23a0ea15d1e1..ee7f74576ca0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py
@@ -88,7 +88,12 @@ _RETRYABLE_RPC_STATUSES = frozenset(
# underlying transport connection is closed mid-request (a known upstream pattern, e.g.
# temporalio/sdk-core#807) — another connection blip, not an intentional cancellation. Match the
# phrase, not the whole status, for the same reason as above.
-_RETRYABLE_RPC_MESSAGES = ("h2 protocol error", "Timeout expired", "operation was canceled")
+#
+# tonic's generic fallback for a broken connection (e.g. the TCP connection reset or closed before
+# a response arrived) surfaces as status UNKNOWN with the bare message "transport error" — no more
+# specific h2/cancellation detail available. Like the "h2 protocol error" case above, this is a
+# connection blip rather than the server rejecting the request.
+_RETRYABLE_RPC_MESSAGES = ("h2 protocol error", "Timeout expired", "operation was canceled", "transport error")
def _is_retryable_rpc_error(error: RPCError) -> bool:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py
index ea80dbf31d77..2b2ef750628e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py
@@ -139,6 +139,9 @@ class TestTransientRPCRetry:
("namespace rate limit exceeded", RPCStatusCode.RESOURCE_EXHAUSTED),
("downstream duration timeout", RPCStatusCode.DEADLINE_EXCEEDED),
("dns error", RPCStatusCode.UNAVAILABLE),
+ # tonic's generic fallback for a broken connection — UNKNOWN with no more specific
+ # h2/cancellation detail available — must still be ridden out in-process.
+ ("transport error", RPCStatusCode.UNKNOWN),
],
)
@patch(