ds4 icon indicating copy to clipboard operation
ds4 copied to clipboard

Non-thinking streaming output broken after commit fe2d3b0

Open links486 opened this issue 3 months ago • 3 comments

Commit fe2d3b0 prevents streaming responses from working correctly for non-thinking content in frontends (e.g. Open WebUI) where native tool calling is the default. Found the commit using git bisect.

The end result is that instead of being able to see and start reading the response right away, nothing at all appears after reasoning is done until the final token completes. For longer responses this can introduce extremely long gaps where the output is blank and feels highly delayed.

For common use cases like web searches, being able to see the answer in the output as quickly as possible is important, even if the model is still emitting additional context.

Temporary workaround for anyone else seeing this, which rewinds to the commit just before this change was introduced:

  • git checkout 769411247560dcc599369bba5fe2d6df8ac3fd0b
  • make clean
  • make
  • relaunch

links486 avatar Aug 11 '26 23:08 links486

Thanks for the clean bisect and repro — that pinned it immediately. Opened #787 with a fix.

Root cause: fe2d3b0 (#678) guards against a tool-enabled model writing a second reasoning pass into the answer channel closed by a literal </think>. On the streaming path that guard held all answer text back until a second </think>, a tool call, or the final chunk — so for the common single-pass case (thinking + tools, one reasoning block, a plain answer with no tool call) nothing streamed until the end, exactly what you saw.

Whether post-</think> text is answer or a second reasoning pass depends on whether a second </think> ever shows up — a whole-stream property with no early signal — so #787 streams the answer as content in real time and just drops any stray </think> inline (safe per #678's own data: the tag is a single, never-split token and the model never re-opens <think>). Net: streaming restored for every thinking+tools turn, and a stray tag is now suppressed rather than forwarded verbatim.

Verified end-to-end on M5 Max / Metal with a tool defined and thinking on, on a prompt answered directly (your case): content now starts 0.95 s before [DONE] across 43 deltas, versus a single burst at [DONE] before the change.

Flor1an-B avatar Aug 12 '26 12:08 Flor1an-B

Sadly, still an issue in the glm-5.3-flash branch right now, where the temporary workaround no longer works. Makes any response with tools enabled feel very slow. Will try your patch!

links486 avatar Aug 28 '26 19:08 links486

Patches no longer apply after the latest changes.

links486 avatar Sep 23 '26 01:09 links486