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(railway): keep exhausted read timeouts out of error tracking (#75923)

Tom Owers07cef11e58fd
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/source.py
index 4417e47ddfc6..4752380b4d7f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/source.py
@@ -83,6 +83,17 @@ Note that Railway rate limits API requests per plan (as low as 100 requests/hour
"Railway API error: Not Authorized": "Your Railway API token is invalid, revoked, or lacks access to this resource. Create a new account or workspace token in your Railway account settings, then reconnect.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `_execute` already retries 429/5xx (as the "Railway API error (retryable)" sentinel),
+ # connection failures, and read timeouts in-process. Once that budget exhausts, Temporal
+ # retries the whole activity and the failure is transient and self-recovering, so don't
+ # surface it as tracked exception noise. The host is a constant, not user input, so
+ # matching on it doesn't risk swallowing an unrelated failure.
+ return {
+ "Railway API error (retryable)",
+ "HTTPSConnectionPool(host='backboard.railway.com', port=443)",
+ }
+
def get_schemas(
self,
config: RailwaySourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py
index d2f6cf4851f1..d05e1cb99d67 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py
@@ -80,6 +80,29 @@ class TestRailwaySource:
assert error_message == expected_message
mock_validate.assert_called_once_with("railway-token")
+ @parameterized.expand(
+ [
+ ("rate_limit", "Railway API error (retryable): status=429, retry_after=60"),
+ ("server_error", "Railway API error (retryable): status=500, retry_after=None"),
+ (
+ "connection_error",
+ "HTTPSConnectionPool(host='backboard.railway.com', port=443): Max retries exceeded with url: "
+ '/graphql/v2 (Caused by ReadTimeoutError("HTTPSConnectionPool'
+ "(host='backboard.railway.com', port=443): Read timed out. (read timeout=60)\"))",
+ ),
+ (
+ "read_timeout",
+ "HTTPSConnectionPool(host='backboard.railway.com', port=443): Read timed out. (read timeout=60)",
+ ),
+ ]
+ )
+ def test_retryable_errors_match_transient_failures(self, _name, observed_error):
+ # `_execute` already retries these in-process; once that budget exhausts, this keeps the
+ # benign, self-recovering failure out of error tracking (see the ReadTimeout that used to
+ # slip through and get reported as a tracked exception).
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)
+
def test_get_resumable_source_manager_binds_resume_config(self):
inputs = mock.MagicMock()