fix(ai): support JSONL responses in Google-compatible streams - #3887
Open
Loxia106 wants to merge 1 commit into
Open
fix(ai): support JSONL responses in Google-compatible streams#3887Loxia106 wants to merge 1 commit into
Loxia106 wants to merge 1 commit into
Conversation
Loxia106
force-pushed
the
pr/google-ndjson-stream-fallback
branch
from
August 6, 2026 00:47
f22a51b to
bc9167f
Compare
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.
What
Why
Google-compatible streaming providers can return newline-delimited JSON while exposing the same streaming response schema. Treating those records as SSE drops valid chunks because they do not use SSE framing.
The parser selection is limited to an explicit media-type allowlist so unknown response types continue to use the existing SSE path.
Testing
bun test packages/ai/test/google-stream-content-type.test.ts packages/ai/test/google-safety-stop.test.ts— 12 passed, 0 failed, 93 assertionsbun --cwd=packages/ai run check— passedgit diff --check upstream/dev...HEAD— passedCI=0 bun check— blocked by an unchanged upstream canonicalization self-test (expected exit 1, got 0); the focused tests and complete AI package check passGJC verdict
devbun checkpasses