From e23d06dda4f4ef22a046da3a034f58091a31c40e Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Wed, 20 May 2026 19:01:31 -0700 Subject: [PATCH] test(realtime): expect session.created as xAI realtime initial event (#28424) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xAI's Grok Voice Agent API now sends session.created as its first realtime event (matching OpenAI), followed by conversation.created. The E2E canary pinned the old conversation.created value and failed. LiteLLM's xAI realtime path is a verbatim passthrough (provider_config is None, raw forwarding), so the event ordering is xAI's own — no transformation on our side. Update the pinned expected value and the now-stale comments to match the current API behavior. --- tests/llm_translation/realtime/base_realtime_tests.py | 2 +- tests/llm_translation/realtime/test_xai_realtime.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/llm_translation/realtime/base_realtime_tests.py b/tests/llm_translation/realtime/base_realtime_tests.py index 1d55f13b00..f1c4265900 100644 --- a/tests/llm_translation/realtime/base_realtime_tests.py +++ b/tests/llm_translation/realtime/base_realtime_tests.py @@ -79,7 +79,7 @@ class RealTimeWebSocketClient: def _is_initial_event(self, msg_type: str) -> bool: """Check if message type is an initial connection event""" - # OpenAI sends "session.created", xAI sends "conversation.created" + # OpenAI and xAI send "session.created"; some providers send "conversation.created" return msg_type in ["session.created", "conversation.created"] async def receive_text(self): diff --git a/tests/llm_translation/realtime/test_xai_realtime.py b/tests/llm_translation/realtime/test_xai_realtime.py index 0bb7a59bb1..86d0ebe3a3 100644 --- a/tests/llm_translation/realtime/test_xai_realtime.py +++ b/tests/llm_translation/realtime/test_xai_realtime.py @@ -19,8 +19,8 @@ class TestXAIRealtime(BaseRealtimeTest): """ E2E tests for xAI Realtime API. - xAI's Grok Voice Agent API is OpenAI-compatible but uses: - - Different initial event: "conversation.created" instead of "session.created" + xAI's Grok Voice Agent API is OpenAI-compatible: + - Initial event: "session.created" (matches OpenAI) - Different endpoint: wss://api.x.ai/v1/realtime - Model: grok-4-1-fast-non-reasoning """ @@ -32,4 +32,4 @@ class TestXAIRealtime(BaseRealtimeTest): return "XAI_API_KEY" def get_initial_event_type(self) -> str: - return "conversation.created" + return "session.created"