Repository navigation
Studio: honor stream=false on the GGUF agentic tool path (#6570) - #6618
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
@codex review |
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@codex review |
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |

Closes #6570
Problem
With server-side tools enabled, the GGUF
/v1/chat/completionspath returned an SSE stream even when the request set"stream": false. Non-streaming clients (and health checks like LiteLLM) gottext/event-streaminstead of a JSON object and choked.It hit hardest via
unsloth studio run --model ..., which forces the tool policy on process-wide (#5277). With tools always on, every plain request hit the tool loop, whose return was an unconditional_SameTaskStreamingResponse(...)with noif payload.streamguard (unlike the standard GGUF and safetensors tool paths). Loading the same model from the GUI left the policy unset, so it only reproduced on the CLI-preload path.Fix
Gate the tool path's streaming return on
payload.stream. Whenstream:false, drain the same agentic generator and build a singleChatCompletion, mirroring the safetensors tool path and the standard GGUF non-streaming branch.stream:trueis unchanged.Two adjacent items cleared here:
_build_metadata_eventnow preservesprompt_tokens_details, so the tool path reports realcached_tokensinstead of always 0 (fixes both the streaming and non-streaming tool paths).The
confirm_tool_calls-requires-stream 400 guard still fires first, so confirmation-gated requests can't reach the drain.Verification
test_gguf_tool_non_streaming.pycoversstream:false+tools (JSON),stream:true(SSE), absent-usage,finish_reason=length, andcached_tokensround-trip. Updated twoTestGgufVisionToolRoutingtests that assumed the old always-stream behavior.stream:false+tools returnsapplication/json,stream:truestill streams.