Repository navigation
gateway: keep Gemini affinity when the first turn omits role - #171
Merged
yetone merged 2 commits intoSep 28, 2026
Merged
Conversation
Add support for Gemini content handling and role omission.
Added tests for role-less content handling and explicit user selection in conversation IDs.
Owner
|
Thanks! Reviewed every line and verified end to end through the gateway (probe tests against scripted upstreams, and the new tests fail without the change). Merged; it'll ship in the next release. |
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
Keep Gemini conversation affinity on the first turn when that
contentsitem has norole. Gemini treats an omitted role as user, but the affinity selector previously skipped it as soon as a later turn had an explicitrole: "user"item. This could send one conversation to different keys.Limit the omitted-role rule to Gemini
contents. Chatmessagesand Responsesinputstill select the first explicitly marked user turn. Add a regression for the two-turn Gemini case, a different first message, and controls for Chat and Responses.This follows the maintainer's note on #165: #165 (comment)
Tests
bdf3d11before the fix with two different Gemini IDs.GOPROXY=off GOSUMDB=off go test ./internal/gateway -count=1passed after the fix.Instinct assisted with the change and tests.