mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(router): send /v1/messages lifecycle frames live when only a retry can take over With the router's default retries and no fallback, message_start and content_block_start were held until the first content delta, so a long thinking pass showed the client nothing but the proxy's keepalive ping. They now go out as soon as the provider sends them, and a retry before content drops its repeat of the frames already sent. A fallback or a refusal fallback keeps the hold. * fix(router): send /v1/messages message_start live when only a retry can take over With default num_retries, every lifecycle frame waited for the first content delta, so a long thinking pass showed the client nothing but the 15 s keepalive ping. Now message_start, plus any ping or SSE comment in front of it, goes out as soon as the provider sends it whenever only a same-group retry can take over Block starts and every other pre-content frame stay held, because a retry's first block can differ from the first attempt's (adaptive thinking can open text where the first attempt opened thinking, and redacted_thinking carries new data each time). A retry or a context-window fallback drops its own message_start and then sends its frames unchanged, so the client sees one message_start and a valid frame sequence. A fallback, refusal fallback, order level, or weighted failover left keeps the full hold, and so does a stream whose first frame is not recognized * test(integration): pin message_start sent live when only a retry can take over * test(router): cover live pings, repeat retries, replayed retries, and a cut retry on /v1/messages streams * test(integration): expect the first attempt's message id when a retry follows a live message_start * test(integration): assert one message_start on a retried bridged messages stream * fix(router): keep message_start held for threaded /v1/messages streams A request with a message thread keeps the old hold, so the client sees the message id of the attempt that answers and its next continue finds the thread. Also types two test literals and the guardrail initializer lookup so the basedpyright count stops flipping between runs. * fix(router): keep message_start held when a context window fallback can answer the stream A context_window_fallbacks list for the stream's group can take over after a retry fails, so the stream policy now reports it and message_start waits for content as before. streaming.py also reuses the shared SSE frame terminators. * fix(router): keep held /v1/messages streams on base's raw reads so a ping next to message_start stays held * fix(router): detect a content delta split across reads on held /v1/messages streams * docs(router): name context_window_fallback in the stream_policy stub * fix(router): keep the client's message id and ping order after a live message_start retry * test(messages): read the retried stream's spend row under the id the client saw * fix(router): log the client's message id on a retried stream's own logging object * fix(messages): carry the call's logger on the SDK stream so a retried stream logs the client's message id --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| chat_bridge | ||
| providers | ||
| responses_bridge | ||
| safeguards | ||
| test_anthropic_messages_caller_tools_wire.py | ||
| test_beta_gated_fields_wire.py | ||
| test_finished_requests_freed_wire.py | ||
| test_guardrail_block_stream.py | ||
| test_guardrail_long_tool_names_wire.py | ||
| test_guardrail_rewrite_keeps_turn_fields_wire.py | ||
| test_message_threads_wire.py | ||
| test_messages_additional_drop_params_wire.py | ||
| test_tool_result_text_wire.py | ||