litellm/tests/unit/integrations/compression_interception
chaznm 1e505bde4e
fix(anthropic): stream /v1/messages text before an internal retrieve tool call (#53658)
* fix(anthropic): stream /v1/messages text before an internal retrieve tool call

Hold-back mode buffered the whole stream behind keepalive pings whenever a server-fulfilled tool was in the request, so clients saw no text until the turn ended. Frames now stream live until the first tool_use or the end of the message, only those frames wait for the hooks, and a follow-up continues the same message with its content block indexes moved past the live ones.

* fix(compression): keep the pre-tool text in the retrieve follow-up turn

* fix(proxy): send the compression follow-up only the text the client already saw

On a streaming request the follow-up keeps the text blocks before the first tool_use, which the client already received. A non-streaming request gets none of them, since its client only sees the follow-up's message. Ping tests now run on a virtual clock, and a frame the stream cut off starts the hold.

* fix(proxy): keep a re-sent live message from repeating text the client already has

A hook that returns the live message as a whole dict no longer resends the blocks already streamed, and the virtual clock test runner closes its loop the way Python 3.10 needs

* test(proxy): type the gated stream and hook runner test helpers

* test(messages): pin that a stream failing before any output fails its first read

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-23 05:17:36 +00:00
..
__init__.py
test_compression_interception_handler.py fix(anthropic): stream /v1/messages text before an internal retrieve tool call (#53658) 2026-11-23 05:17:36 +00:00