: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
chore(llm-gateway): xfail live integration tests on provider flakiness (#61237)
Raúl Negrón-Otero9f449239a77a
diff --git a/services/llm-gateway/tests/integration/test_anthropic_sdk.py b/services/llm-gateway/tests/integration/test_anthropic_sdk.pyindex 800007deca7c..5460a91456bb 100644--- a/services/llm-gateway/tests/integration/test_anthropic_sdk.py+++ b/services/llm-gateway/tests/integration/test_anthropic_sdk.py@@ -23,6 +23,8 @@ ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY")TEST_IMAGE_URL = "https://posthog.com/brand/posthog-logo.png"+pytestmark = pytest.mark.xfail(strict=False, reason="Anthropic may be rate-limited or temporarily unavailable")+@dataclassclass SDKTestConfig:diff --git a/services/llm-gateway/tests/integration/test_callbacks.py b/services/llm-gateway/tests/integration/test_callbacks.pyindex a02ef807dc1f..d65de2e39c6b 100644--- a/services/llm-gateway/tests/integration/test_callbacks.py+++ b/services/llm-gateway/tests/integration/test_callbacks.py@@ -18,6 +18,8 @@ ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY")OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")ANTHROPIC_TEST_MODEL = "claude-haiku-4-5-20251001"+pytestmark = pytest.mark.xfail(strict=False, reason="Upstream provider may be rate-limited or temporarily unavailable")+class TestCallbacksFireOnAnthropicRequest:pytestmark = pytest.mark.skipif(not ANTHROPIC_API_KEY, reason="ANTHROPIC_API_KEY not set")diff --git a/services/llm-gateway/tests/integration/test_openai_sdk.py b/services/llm-gateway/tests/integration/test_openai_sdk.pyindex 4c7a84c0439d..f0ad398fa3cf 100644--- a/services/llm-gateway/tests/integration/test_openai_sdk.py+++ b/services/llm-gateway/tests/integration/test_openai_sdk.py@@ -17,6 +17,9 @@ from openai.types.chat import ChatCompletionToolChoiceOptionParam, ChatCompletioOPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")skip_without_openai_key = pytest.mark.skipif(not OPENAI_API_KEY, reason="OPENAI_API_KEY not set")+xfail_provider_unavailable = pytest.mark.xfail(+ strict=False, reason="OpenAI may be rate-limited or temporarily unavailable"+)TEST_IMAGE_URL = "https://posthog.com/brand/posthog-logo.png"@@ -54,6 +57,7 @@ class TestOpenAIModelsEndpoint:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIChatCompletions:def test_non_streaming_request(self, openai_client: OpenAI):response = openai_client.chat.completions.create(@@ -109,6 +113,7 @@ class TestOpenAIChatCompletions:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIMultipleModels:def test_gpt4o_mini_request(self, openai_client: OpenAI):response = openai_client.chat.completions.create(@@ -155,6 +160,7 @@ class TestOpenAIMultipleModels:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIToolCalling:def test_tool_definition_and_response(self, openai_client: OpenAI):tools: list[ChatCompletionToolParam] = [@@ -230,6 +236,7 @@ class TestOpenAIToolCalling:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIVision:def test_image_url_input(self, openai_client: OpenAI):response = openai_client.chat.completions.create(@@ -269,6 +276,7 @@ class TestOpenAIVision:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIMultiTurn:def test_conversation_history(self, openai_client: OpenAI):response = openai_client.chat.completions.create(@@ -289,6 +297,7 @@ class TestOpenAIMultiTurn:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIJSONMode:def test_json_response_format(self, openai_client: OpenAI):response = openai_client.chat.completions.create(@@ -312,6 +321,7 @@ class TestOpenAIJSONMode:@skip_without_openai_key+@xfail_provider_unavailableclass TestOpenAIValidationErrors:@pytest.mark.parametrize("invalid_param,value,expected_error",diff --git a/services/llm-gateway/tests/integration/test_openai_transcription.py b/services/llm-gateway/tests/integration/test_openai_transcription.pyindex aa652901274e..37e85860745b 100644--- a/services/llm-gateway/tests/integration/test_openai_transcription.py+++ b/services/llm-gateway/tests/integration/test_openai_transcription.py@@ -18,6 +18,7 @@ AUDIO_SAMPLES_DIR = Path(__file__).parent / "audio_samples"AUDIO_EXTENSIONS = {".mp3", ".m4a", ".wav", ".webm", ".mp4", ".mpeg", ".mpga", ".oga", ".ogg", ".flac"}skip_without_openai_key = pytest.mark.skipif(not OPENAI_API_KEY, reason="OPENAI_API_KEY not set")+pytestmark = pytest.mark.xfail(strict=False, reason="OpenAI may be rate-limited or temporarily unavailable")@pytest.fixturediff --git a/services/llm-gateway/tests/integration/test_streaming_usage.py b/services/llm-gateway/tests/integration/test_streaming_usage.pyindex fec6f7b4b08f..dfe06901a101 100644--- a/services/llm-gateway/tests/integration/test_streaming_usage.py+++ b/services/llm-gateway/tests/integration/test_streaming_usage.py@@ -13,7 +13,10 @@ from anthropic import AnthropicANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY")-pytestmark = pytest.mark.skipif(not ANTHROPIC_API_KEY, reason="ANTHROPIC_API_KEY not set")+pytestmark = [+ pytest.mark.skipif(not ANTHROPIC_API_KEY, reason="ANTHROPIC_API_KEY not set"),+ pytest.mark.xfail(strict=False, reason="Anthropic may be rate-limited or temporarily unavailable"),+]class TestStreamingUsageExtraction: