: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(langsmith): stop retrying a request LangSmith rejects (#95593)
Tom Owers77191d754057
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/source.pyindex 4610c19c512d..2cd158ab5eec 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/source.py@@ -99,6 +99,11 @@ Leave the **Host** field blank for the US cloud (`api.smith.langchain.com`). Setdef get_non_retryable_errors(self) -> dict[str, str | None]:return {+ # LangSmith rejects the request itself — a filter or parameter its deployment doesn't+ # accept — rather than the credentials. The request shape is fixed per endpoint, so+ # every retry sends the identical query and is rejected identically. `_fetch_page`+ # logs the response body, which is the only place the vendor's reason survives.+ "400 Client Error": "LangSmith rejected PostHog's request for this table. Check that the Host field matches your LangSmith region or deployment, then contact support if it keeps failing.","401 Client Error": "Your LangSmith API key is invalid or has been revoked. Create a new API key in your LangSmith settings, then reconnect.","403 Client Error": "Your LangSmith API key does not have access to this workspace. Check the key's workspace scope, then reconnect.",REPEATED_CURSOR_ERROR: "LangSmith kept returning the same pagination cursor, so the import was stopped to avoid looping. This usually means the host is misconfigured. Check the Host field, then reconnect.",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/tests/test_langsmith_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/tests/test_langsmith_source.pyindex 3d9d47924cc1..de6979330c60 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/tests/test_langsmith_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/langsmith/tests/test_langsmith_source.py@@ -112,6 +112,14 @@ class TestLangSmithSource:non_retryable = self.source.get_non_retryable_errors()assert any(RESPONSE_TOO_LARGE_ERROR in key for key in non_retryable)+ def test_rejected_request_is_non_retryable(self):+ # A 4xx means LangSmith rejected the request we built, so every retry re-sends the same+ # query for the whole activity budget and stores the raw requests error for the customer.+ non_retryable = self.source.get_non_retryable_errors()+ message = non_retryable["400 Client Error"]+ assert message is not None+ assert "Host field" in message+def test_documented_tables_render_from_static_catalog(self):# lists_tables_without_credentials must expose the table catalog (+ canonical descriptions)# for the public docs <SourceTables /> component without needing credentials.