: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(linear): classify exhausted-retry errors as retryable (#126700)
Tom Owers9ef134e59a84
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linear/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linear/source.pyindex c1fbc4276ced..ae46b9001bc6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linear/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linear/source.py@@ -99,6 +99,19 @@ class LinearSource(ResumableSource[LinearSourceConfig, LinearResumeConfig], OAut# so it must not disable the schema.}+ def get_retryable_errors(self) -> set[str]:+ # linear.py's own tenacity retry already rides out 5xx, 429, GraphQL-wrapped internal+ # errors and transient network blips (LINEAR_MAX_RETRY_ATTEMPTS attempts with backoff).+ # A LinearRetryableError only reaches here once that in-process budget is exhausted, so+ # Temporal retrying the whole activity is the self-recovering next step, not a bug to page on.+ return {+ "Linear: server error",+ "Linear: rate limited",+ "Linear: internal server error",+ "Linear: transient network error",+ "Linear: incomplete JSON response",+ }+def _get_access_token(self, config: LinearSourceConfig, team_id: int) -> str:integration = self.get_oauth_integration(config.linear_integration_id, team_id)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linear/test_linear.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linear/test_linear.pyindex 27d4c0511f06..33b4972a7e41 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linear/test_linear.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linear/test_linear.py@@ -352,6 +352,41 @@ class TestLinearSourceNonRetryableErrors:assert not any(key in observed_error for key in non_retryable_errors)+class TestLinearSourceRetryableErrors:+ @parameterized.expand(+ [+ # Messages linear.py actually raises once LinearRetryableError exhausts its own+ # in-process retry budget - these must be classified as retryable so the exhausted-retry+ # failure is logged as a warning and the whole activity retries, instead of being+ # reported to error tracking as a bug.+ ("server_error", "Linear: server error 503"),+ ("http_rate_limited", "Linear: rate limited (429)"),+ ("graphql_rate_limited", "Linear: rate limited - RATELIMITED"),+ ("graphql_internal_server_error", "Linear: internal server error - Internal server error"),+ (+ "transient_network_error",+ "Linear: transient network error - HTTPSConnectionPool(host='api.linear.app', port=443): Read timed out. (read timeout=60)",+ ),+ ("incomplete_json_response", "Linear: incomplete JSON response (Expecting value: line 1 column 1)"),+ ]+ )+ def test_retryable_errors_match(self, _name: str, observed_error: str) -> None:+ retryable_errors = LinearSource().get_retryable_errors()+ assert any(key in observed_error for key in retryable_errors)++ @parameterized.expand(+ [+ # A genuine GraphQL error (not rate-limiting or an internal-server blip) is a real bug+ # or unsupported request shape, so it must not be swallowed as a benign retry.+ ("graphql_error", "Linear GraphQL error: Something failed"),+ ("unexpected_response_format", "Unexpected Linear response format. Keys: ['foo']"),+ ]+ )+ def test_retryable_errors_does_not_match_non_transient(self, _name: str, observed_error: str) -> None:+ retryable_errors = LinearSource().get_retryable_errors()+ assert not any(key in observed_error for key in retryable_errors)++class TestValidateCredentials:@parameterized.expand([