fix: raise FerroStreamError on malformed streaming chunks#27
Merged
Conversation
Both the sync and async _stream() paths swallowed JSONDecodeError with a
bare `continue`, silently dropping malformed SSE chunks and losing data
with no error or log. They now raise FerroStreamError instead — the first
code path that actually raises this previously-unused exception.
Also adds the {"plugins": [...]} wrapper coverage for admin.plugins.list()
and streaming malformed-chunk regression tests for both clients.
Closes #15
Closes #16
Add .github/release.yml so GitHub's auto-generated release notes (the publish job already runs softprops/action-gh-release with generate_release_notes: true) group merged PRs by label and credit every contributor by @handle, plus a "New Contributors" section. Contributor credit lives in the release notes only, not in CHANGELOG.md.
MitulShah1
force-pushed
the
fix/stream-error-malformed-chunks
branch
from
June 12, 2026 14:02
9ebbb21 to
85f33b9
Compare
Merged
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.
Summary
Fixes the one open
bug-labeled issue plus its sibling enhancement, both on the same code path:_stream()silently swallowed malformed SSE chunks (except json.JSONDecodeError: continue), losing data with no error or log.FerroStreamErrorwas defined and exported but never raised anywhere.Both sync (
completions/resource.py) and async (completions/async_resource.py)_stream()paths now raiseFerroStreamErroron a malformed chunk, with a truncated payload snippet and the originalJSONDecodeErrorchained viaraise ... from e. This is the first code path that actually raisesFerroStreamError.Also:
admin.plugins.list(){"plugins": [...]}wrapper branch, plus streaming malformed-chunk regression tests (sync + async)..github/release.ymlso GitHub's auto-generated release notes (the publish job already runs withgenerate_release_notes: true) group merged PRs by label and credit every contributor by@handleon each tagged release. Contributor credit lives in the release notes only — not inCHANGELOG.md.Fixed Issues
Closes #15
Closes #16
Testing
pytest tests/— 67 passed (was 64).ruff check/ruff format --check— clean.mypy ferrolabsai— Success, no issues..github/release.ymlvalidated as well-formed YAML (10 categories).Notes
FerroStreamError.