Repository navigation
client: detect incomplete chat and generation streams - #797
Open
remote-controlled-man wants to merge 1 commit into
Open
remote-controlled-man wants to merge 1 commit into
remote-controlled-man wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
This branch has not been deployed
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.
A streamed
chat()orgenerate()response can end cleanly at the HTTP layer before Ollama sendsdone: true. The sync and async iterators currently stop normally, allowing consumers to treat truncated output as complete.Track the completion marker and raise the existing
ResponseErrorat natural EOF when it is absent, while preserving chunks already yielded. This follows the completion check in the official JavaScript client. The change leaves non-streaming calls and pull/push/create progress streams unchanged.The new stream tests fail on the original implementation (12 failed, 28 passed) and pass after the fix (40 passed, Python 3.12). They cover empty/incomplete streams, normal completion with and without a final newline, explicit close, and HTTP/server/JSON errors, including an error after
done: true.Validation on the final commit:
hatch test -acp: 162 passed in each of eight environments, Python 3.10–3.15, including 3.14t and 3.15t. Local requests explicitly bypassed the machine's proxy.uv lock --check, and theuv exportcomparison withrequirements.txtpassed.uv build --sdist --wheelpassed; both file lists were checked for accidental environment or reproduction artifacts.The Hatch coverage controllers emitted no-data warnings, while the combined coverage report completed successfully. Hosted CI and Python 3.8/3.9 runtime tests have not been run; Python 3.8 syntax was checked.
Found through proactive local protocol fault injection using a local HTTP server, without model/API calls. Prepared with OpenAI Codex assistance.