fix(#3996): drop gateway SSE keepalive frames before the genai parser - #4022
Draft
aheritier wants to merge 2 commits into
Draft
fix(#3996): drop gateway SSE keepalive frames before the genai parser#4022aheritier wants to merge 2 commits into
aheritier wants to merge 2 commits into
Conversation
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
August 24, 2026 15:13
30bb441 to
01ecbc9
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
August 25, 2026 07:58
01ecbc9 to
c3771e3
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
August 25, 2026 20:24
c3771e3 to
e69c90a
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
August 26, 2026 11:08
e69c90a to
c064d65
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
2 times, most recently
from
September 1, 2026 16:16
2aeb274 to
c064d65
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 1, 2026 16:29
c064d65 to
a4ac3c3
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 6, 2026 16:14
a4ac3c3 to
cb11ede
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 7, 2026 11:19
cb11ede to
b6673c4
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 7, 2026 11:34
b6673c4 to
5f3d225
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 7, 2026 16:13
5f3d225 to
2a91635
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 7, 2026 16:47
2a91635 to
0c7381a
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 8, 2026 06:17
0c7381a to
d4c26ba
Compare
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 8, 2026 07:57
d4c26ba to
d5981c4
Compare
Capture actual GenerateContentStream JSON on gateway and direct Gemini API. Use a populated private catalogue to assert omitted/empty declaration resolution, explicit false precedence, unknown-off behavior, explicit true, and utility omission. Reject incompatible request shapes before dispatch. Test the resolved-capability predicate for gateway, direct API, Vertex AI, and unknown/empty surfaces. Vertex coverage here is the predicate, not a captured Vertex wire request or live provider call. All fixtures use local servers and require no provider credentials or generated image response.
During long generations (e.g. Gemini image output) the Docker AI Gateway
emits `event: keepalive` + `data: {}` frames. google.golang.org/genai
treats any `event:` line as a fatal invalid stream chunk, so a single
keepalive killed the whole stream.
Add an opt-in httpclient.WithSSEKeepaliveFilter that makes the shared SSE
filter transport also drop payload-free keepalive frames, and enable it
only on the Gemini gateway HTTP client. The shared default path is
unchanged: Anthropic-style named events with meaningful data still pass
through verbatim, and only the gateway surface — never direct
Gemini/Vertex — gets the new behavior.
aheritier
force-pushed
the
gemini-gateway-transport
branch
from
September 8, 2026 17:31
d5981c4 to
601da3b
Compare
Collaborator
Author
|
👋 This PR has merge conflicts with the base branch. Please rebase or merge the latest base branch and resolve them. I've moved it to draft and added |
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
Filters gateway SSE keepalive frames before they reach the Gemini genai parser, while retaining normal response events.
Why
Gateway transport heartbeats are not model events and can otherwise cause parser failures or corrupt streaming behavior.
Validation
task test; HTTP SSE filter and Gemini transport tests.Test instructions
Run:
task testStream a Gemini response containing gateway SSE keepalive frames followed by content and a terminal event. Expected: keepalive frames are discarded before parsing, content remains intact, and the stream terminates normally.