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(convex): stop reporting already-retried 5xx/429 as tracked errors (#76779)

Tom Owers9a3337f8f029
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
index 18ae610834ef..33d5c7b7a1ba 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/source.py
@@ -123,6 +123,15 @@ You can find your deployment URL and deploy key in your [Convex Dashboard](https
"is older than Convex's ~30 day retention window": "Delta cursor is older than Convex's ~30 day retention window. Please trigger a full resync of this source.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `_CONVEX_RETRY` (convex.py) already retries 429/5xx, including the Cloudflare 52x/530
+ # family Convex deployments can surface, at the urllib3 layer before this can even raise.
+ # A response that still exhausts that budget is a transient Convex/edge blip, not a bug,
+ # so Temporal's activity retry recovers once it clears rather than surfacing it as tracked
+ # exception noise. `requests.Response.raise_for_status` derives these prefixes from the
+ # status code alone, not the vendor's reason text, so they're stable to match on.
+ return {"Server Error", "429 Client Error"}
+
def validate_credentials(
self,
config: ConvexSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
index e2fffcf77d61..c6ed08213ae2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
@@ -538,3 +538,38 @@ class TestConvexNonRetryableErrors:
def test_transient_errors_do_not_match(self, _name: str, observed_error: str) -> None:
non_retryable_errors = ConvexSource().get_non_retryable_errors()
assert not any(key in observed_error for key in non_retryable_errors)
+
+
+class TestConvexRetryableErrors:
+ @parameterized.expand(
+ [
+ (
+ "500",
+ "500 Server Error: Internal Server Error for url: "
+ "https://x.convex.cloud/api/list_snapshot?tableName=events&format=json",
+ ),
+ ("502", "502 Server Error: Bad Gateway for url: https://x.convex.cloud/api/document_deltas"),
+ ("503", "503 Server Error: Service Unavailable for url: https://x.convex.cloud/api/list_snapshot"),
+ ("504", "504 Server Error: Gateway Timeout for url: https://x.convex.cloud/api/document_deltas"),
+ ("cloudflare_520", "520 Server Error: Unknown Error for url: https://x.convex.cloud/api/list_snapshot"),
+ ("429", "429 Client Error: Too Many Requests for url: https://x.convex.cloud/api/list_snapshot"),
+ ]
+ )
+ def test_transient_errors_are_recognized_as_retryable(self, _name: str, observed_error: str) -> None:
+ retryable_errors = ConvexSource().get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors), observed_error
+
+ @parameterized.expand(
+ [
+ ("401", "401 Client Error: Unauthorized for url: https://x.convex.cloud/api/document_deltas"),
+ ("403", "403 Client Error: Forbidden for url: https://x.convex.cloud/api/document_deltas"),
+ (
+ "invalid_window",
+ "Delta cursor for table 'events' is older than Convex's ~30 day retention window. "
+ "Please trigger a full resync of this source.",
+ ),
+ ]
+ )
+ def test_non_retryable_errors_do_not_match(self, _name: str, observed_error: str) -> None:
+ retryable_errors = ConvexSource().get_retryable_errors()
+ assert not any(key in observed_error for key in retryable_errors), observed_error