From 20764dd34236cc1a6e4fefd658b6931c4a25681c Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 22 May 2026 22:14:15 +0000 Subject: [PATCH] fix(realtime): record synthetic session.created in deferred-setup mode The deferred-setup path emits a synthetic session.created directly to the client websocket but did not run it through RealTimeStreaming's store_message, so the event was missing from the session log used by success_handler / async_success_handler. Call store_message before forwarding so the synthetic event lands in the same log stream as provider-driven events. --- litellm/llms/custom_httpx/llm_http_handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index df06bd8d3fe..1b0ee1b9be5 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -5227,7 +5227,13 @@ class BaseLLMHTTPHandler: session_configuration_request=None, ) if synthetic_session is not None: - await websocket.send_text(json.dumps(synthetic_session)) + synthetic_session_str = json.dumps(synthetic_session) + # Record before sending so the synthetic session.created is + # captured in the session log alongside provider-driven + # events; without this it would be silently absent from + # success_handler / async_success_handler payloads. + realtime_streaming.store_message(synthetic_session_str) + await websocket.send_text(synthetic_session_str) realtime_streaming._session_created_sent_to_client = True verbose_logger.debug( "Sent synthetic session.created to client to unblock connection"