Repository navigation
Conversation
Some OpenAI-compatible providers put the last content delta in the same chunk as finish_reason "stop" or "length". The stream handler returned on the finish reason before appending that chunk's content and reasoning, so the end of the answer was dropped. Accumulate reasoning, thinking signature and content before handling the terminal finish reason. Fixes docker#4715 Signed-off-by: Dean Chen <862469039@qq.com>
aheritier
left a comment
There was a problem hiding this comment.
No substantive code findings in the two-file diff. Accumulating content and reasoning before the terminal return fixes #4715 while preserving marker filtering, XML fallback, and refusal handling. The regression test covers stop and length, checking complete persisted/live text, accumulated reasoning, finish reason, and stopped state.
Validation: Source and tests reviewed at this commit; tests were not run locally.
CI / merge readiness: Not ready at review time. Both ci and codeql concluded action_required, with no CI jobs executed. The PR was conflict-free but blocked. Approval is withheld pending successful CI.
|
yeah, ci and codeql never actually ran. both are sitting on action_required, and I can't approve the workflow from the fork. |
When a provider sends the last content delta in the same chunk as finish_reason stop/length, handleStream returned before appending it, so the tail of the answer got cut off. Moved the reasoning/content handling above the early return and added a test for it.
Fixes #4715