mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(router): keep both errors when a streamed cross-group fallback also fails On /v1/messages and /v1/responses streams, a recovery walk appended the fallback outcome to the MidStreamFallbackError envelope and the stream then raised the inner provider error without it. A fallback hop whose stream opened and then failed before any content never reached the walk, so the primary's error was dropped. The outcome now lands on the surfaced error, and a fallback hop's pre-content failure reads as the walk's own failure would. * fix(proxy): keep the router fallback outcome in Responses response.failed events The response.failed formatter preferred the upstream body message, so the primary error and fallback outcome the router put on the exception never reached the client. Use the exception message when it carries that outcome. * fix(router): only add the primary error to a fallback stream's failure before any content Count any chunk past message_start and pings, split or not, as content on /v1/messages, track forwarded output events on Responses, and switch the response.failed message only on a fallback-also-failed outcome. * fix(router): scope the streamed fallback outcome to pre-content messages and Responses failures Leave the router core and chat streams as they were. Carry the outcome the walk put on the stream's envelope onto the provider error only before any content, and read a fallback hop's /v1/messages stream as whole SSE frames so split or merged chunks are judged by event, not by chunk. * fix(router): keep a Responses stream's own error once it has sent output A primary Responses stream that already sent output no longer lets its fallback stream's failure read as the primary's. Keep CRLF line endings in a rewritten error frame, and read a bridge chunk's type through a typed mapping. * test(router): cover partial frames on a fallback stream's end and raise * fix(router): carry the primary error through a fallback stream's retry and redact the combined frame A fallback group's same-group stream retry keeps the fallback's error context, every fallback-level /v1/messages stream is read as whole frames, and the rewritten error frame goes through the client message redactor. * fix(router): treat a cut-off message_start on a fallback stream as before content * fix(router): redact the primary error and the fallback outcome separately before joining them A traceback in the primary's error made the client redactor drop the fallback outcome that followed it. Make the fallback-retry tests deterministic with a single-deployment fallback group. * test(router): cover a split error frame on a fallback group's retried stream --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| .coverage_baseline | ||
| __init__.py | ||
| _coverage_check.py | ||
| _pin_check.py | ||
| conftest.py | ||
| test_background_health.py | ||
| test_exception_handlers.py | ||
| test_harness_smoke.py | ||
| test_lifecycle.py | ||
| test_openapi_customization.py | ||
| test_proxy_config.py | ||
| test_routes_anthropic_beta.py | ||
| test_routes_assistants.py | ||
| test_routes_audio.py | ||
| test_routes_chat_completions.py | ||
| test_routes_completions.py | ||
| test_routes_config.py | ||
| test_routes_embeddings.py | ||
| test_routes_invitation.py | ||
| test_routes_login_sso.py | ||
| test_routes_misc.py | ||
| test_routes_model_cost_map.py | ||
| test_routes_model_info.py | ||
| test_routes_model_metrics.py | ||
| test_routes_models.py | ||
| test_routes_moderations.py | ||
| test_routes_onboarding.py | ||
| test_routes_queue.py | ||
| test_routes_threads.py | ||
| test_routes_utils.py | ||
| test_spend_counters.py | ||
| test_streaming_helpers.py | ||
| test_team_model_name_translation.py | ||