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(gladly): classify report read-timeouts as retryable (#80790)

Tom Owersaa51af470d33
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
index cb41e70342cd..1201249b958f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
@@ -69,6 +69,17 @@ class GladlySource(ResumableSource[GladlySourceConfig, GladlyResumeConfig]):
"403 Client Error: Forbidden for url": "Gladly denied access. Please check that the agent has the API User permission.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `_report_rows` reads the report CSV straight off `response.raw` (see gladly.py) rather
+ # than through `iter_content`, so a stall in Gladly's report generation past
+ # REQUEST_TIMEOUT_SECONDS raises the bare urllib3 read-timeout while streaming rows —
+ # after `generate_report`'s own retry-on-`requests.ReadTimeout` has already returned a
+ # response, so it isn't caught there either. Temporal's activity retry regenerates the
+ # report and re-streams it; the resumable window state means only the in-flight window is
+ # redone, deduped on merge, so this is self-recovering rather than a tracked-exception-worthy
+ # failure.
+ return {"Read timed out"}
+
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
index f0c0737a5e18..85291833d618 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
@@ -63,6 +63,13 @@ class TestGladlySource:
error = "500 Server Error for url: https://myorg.gladly.com/api/v1/export/jobs"
assert not any(key in error for key in non_retryable_errors)
+ def test_retryable_errors_match_read_timeout(self):
+ # response.raw streaming in _report_rows raises this bare urllib3 message when Gladly
+ # stalls generating a report, uncaught by generate_report's own retry decorator.
+ retryable_errors = self.source.get_retryable_errors()
+ error = "HTTPSConnectionPool(host='myorg.us-1.gladly.com', port=443): Read timed out."
+ assert any(key in error for key in retryable_errors)
+
def test_get_schemas(self):
schemas = self.source.get_schemas(self.config, self.team_id)