fix(realtime): send TEXT frames and valid guardrail session.update#28848
Conversation
Decode backend recv bytes before send_text so clients receive OP_TEXT JSON events. Include turn_detection.type server_vad in injected session.update. Co-authored-by: Cursor <[email protected]>
Greptile SummaryFixes two realtime proxy forwarding bugs in
Confidence Score: 5/5Safe to merge — both fixes are localized, the decode path preserves the loop on failure, and the updated session shape satisfies the GA upstream validation requirement. The bytes-to-str decode is narrowly scoped to the forwarding loop and handles the error case correctly with No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/realtime_streaming.py | Two targeted fixes: bytes-to-str decoding before send_text and adding required type: server_vad to guardrail-injected turn_detection; both paths are exercised before downstream handlers |
| tests/test_litellm/litellm_core_utils/test_realtime_streaming.py | Existing session-shape tests updated to assert the new type: server_vad field; two new async tests added for str-delivery and non-UTF-8 binary skip behavior, all using only mocks (no real network calls) |
Reviews (2): Last reviewed commit: "fix(realtime): skip non-UTF-8 backend bi..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Avoid terminating the forwarding loop on UnicodeDecodeError when the backend sends unexpected binary payloads. Co-authored-by: Cursor <[email protected]>
79a4909
into
litellm_internal_staging
…erriAI#28848) * fix(realtime): send TEXT frames and valid guardrail session.update Decode backend recv bytes before send_text so clients receive OP_TEXT JSON events. Include turn_detection.type server_vad in injected session.update. Co-authored-by: Cursor <[email protected]> * fix(realtime): skip non-UTF-8 backend binary frames Avoid terminating the forwarding loop on UnicodeDecodeError when the backend sends unexpected binary payloads. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
Summary
recv(decode=False)bytes tostrbeforesend_text, so proxy clients receive OP_TEXT JSON events (fixes LiveKit / openai-python clients silently missing server events).turn_detection.type: server_vadin guardrail-injectedsession.updatefor GA Realtime upstreams (fixesMissing required parameter: session.audio.input.turn_detection.type).