Repository navigation
server: a reply that ends inside an unclosed think block answers with its text (fixes #3687) - #3699
Merged
Merged
Conversation
Owner
Author
|
/atc exchange 325907932c0e7815bc755fc75465b57def29c14bd25649aa4f59358261231d0e |
… its text (#3687) A thinking reply that ended at the model's own end token while its think block was still open, with no tool call, returned an empty answer on every route: content "" on chat, a thinking block only on /v1/messages, a reasoning item only on /v1/responses. After the engine finishes, when the block never closed, the model ended the reply itself (not a stop string, max_tokens or the loop guard), the text holds no call opener and no call the route's tool parser reads, and the request forced no tool and no structured output, the text is also the answer. It stays in the reasoning field, so the stream sends it as one content delta at the end and the joined deltas equal the finished reply. The reply says tensorfold.reasoning_recovered: true, the server logs one line, and logprobs keep those tokens under reasoning_content. Token ids, token_sha256 and token counts are unchanged. Kimi's native parse reports whether its think channel is still open. Server goldens: the fake model's thinking replies end at their end token in a block they never close, so 42 golden files (46 replies) and one request-log line now carry the answer; each difference was reviewed to be only that (content, the runtime flag, one more stream content chunk, and the next turn's prompt count in a stored Responses chain).
ashhart
force-pushed
the
lead/reasoning-only-reply
branch
from
November 17, 2026 18:06
8f0d20c to
c68a12a
Compare
1 task done
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3687. A thinking model that finishes at its own end token while its think block is still open, and makes no tool call, used to return an empty answer on every route. Agent clients saw an empty turn. Now its text is returned as the answer too, on chat completions,
/v1/messagesand/v1/responses, streamed and whole.When it applies (in
Generation.finish, after the engine has drained), all must hold:Unchanged: the text stays in the reasoning field as well, so joined stream deltas still equal the final message. Token ids,
token_sha256and token counts are untouched. Requests with structure, stop strings, length cuts and closed blocks reply exactly as before. One line is logged when it happens.Checks: lean level with main, fmt clean, every changed file at most 600 lines.