mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #605] [CLOSED] Open WebUI streaming: no long loop-guard silences, no early thinking close #623
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#623
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/605
Author: @mw00
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:owui-stream📝 Commits (1)
a5d730dOpen WebUI streaming: bounded loop-guard hold, rarer thinking close, budget, MiniMax re-think📊 Changes
7 files changed (+223 additions, -69 deletions)
View changed files
📝
docs/SETTINGS.md(+17 -12)📝
serve/frontend.py(+15 -3)📝
serve/loop_guard.py(+42 -22)📝
serve/server.py(+25 -10)📝
serve/test_loop_guard.py(+89 -21)📝
serve/test_minimax_frontend.py(+25 -0)📝
serve/test_server.py(+10 -1)📄 Description
Problem
In Open WebUI, Maya streams could go silent for many seconds and then dump a burst of text. The "thinking" panel could also close while the model was still reasoning, with the rest of the reasoning shown as the answer. The causes:
</think>the model never wrote. A loop was easy to hit: 3 copies of a block of 32+ tokens. Open WebUI then ends its thinking block early. A stop could also end the stream withfinish_reason: stopand no answer at all.max_tokenscut the thinking budget. For example, 4096 gave about 3071 tokens, and then the thinking was closed.<mm:think>block after the first close was sent as answer text.Fixes
serve/loop_guard.py,HOLD_MAX = 64). The stream is at most 64 tokens behind the model. A copied block streams as it is written. What was sent stays sent. When a loop is confirmed, only the repeats not sent yet are cut, and the short repetition penalty applies as before. After a loop, the detector starts its runs from zero, so the copies already on screen don't count toward the next loop.serve/server.py,THINK_TINY_LIMIT = 1024).max_tokens(or the context left) lowers the budget only when it is 1024 tokens or fewer, for side requests such as a title. A largermax_tokensis the cap on the whole output and leaves the configuredthinking_budgetalone. The rule is documented indocs/SETTINGS.mdand in the code.serve/frontend.py). The rewriter turns<mm:think>into an internal marker. The parser drops the marker while already reasoning, and switches back to reasoning when it appears after an answer part or a tool call. Inside a tool-call value the tag stays text, as before. Open WebUI shows that as a second thinking block, since areasoning_contentdelta after content opens a new reasoning item there.docs/SETTINGS.md("The loop guard" and theMAYA_GLM_THINK_RESERVErow) describes the new rules.Evidence
Mock engine (20 ms a token, a
</think>token, the engine continues from where the prompt got to). The stream is rendered with Open WebUI's rules (open_webui/utils/middleware.py, v0.11.4 and main):thinking closedat token 237; thinking panel ends at 25 s; the rest of the thinking and a literal</think>shown as the answerReal model: GLM-5.3-Flash Maya-S24 on one V100 each, main and branch side by side, the same prompts, streamed with the same Open WebUI-rules client:
max_tokens10000max_tokens4096thinking reached its budget (3071 tokens): the thinking closed early, then an answerfinish_reason: length(see the note below)No loop-guard line in the real-model runs, as expected: copying a draft is not a loop.
Open WebUI itself: the owner's instance (192.168.0.81:3000, v0.11.4) needs a sign-in, and sign-up is off. So it was not used, and nothing was changed there. Jupiter's test ports were reachable from Neptune. The client above applies the same rules as the v0.11.4 source.
Tests: the full
servesuite passes on Linux (470 tests, OK). New and updated tests:test_loop_guard.py: the bounded hold, a copied block that streams on, two penalties before the close, never a stop while thinking, more copies needed in the thinking, a fresh count after a reset, the line instead of an empty answer.test_server.py: larger limits keep the configured budget.test_minimax_frontend.py: a second<mm:think>is reasoning.Notes
max_tokens(for example 4096) and a model that thinks past it now ends withfinish_reason: lengthand little or no answer, instead of a closed thinking at ~3K tokens. Open WebUI sendsmax_tokensonly when it is set in the chat's advanced parameters.How to test
To check with a real client:
loop guard: ... thinking closedline.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.