internal/translator/gemini/interactions: ConvertInteractionsRequestToGemini splits multi-part user_input into consecutive role:"user" turns
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in internal/translator/gemini/interactions/interactions_gemini_common.go, reading convertInteractionsRequestToGemini around lines 39-55 and appendInteractionsContentPart at 1443-1455 to see where one content entry is appended per part. Compare with the already-fixed internal/translator/antigravity/interactions/interactions_antigravity_request.go, which calls translatorcommon.MergeAdjacentGeminiUserContents before writing contents, and apply the same merge in the Gemini path. Done looks like the reproduction test TestRepro_GeminiInteractionsSplitsMultipartUserInput passing with a single merged user turn, plus the existing package tests under ./internal/translator/gemini/interactions still green.
Written by the indexing model from the issue text.
Description
Summary
In internal/translator/gemini/interactions/interactions_gemini_common.go:39-55 (convertInteractionsRequestToGemini) and 1443-1455 (appendInteractionsContentPart), appendInteractionsContentPart appends a separate {"role":"user","parts":[partJSON]} entry for every content part. Unlike convertInteractionsRequestToAntigravity (internal/translator/antigravity/interactions/interactions_antigravity_request.go:32, fixed in 0e981b9f), convertInteractionsRequestToGemini never calls translatorcommon.MergeAdjacentGeminiUserContents(contentItems) before writing contents, emitting consecutive role: "user" turns that violate Gemini's role-alternation rule.
Environment
- CLIProxyAPI revision:
origin/devat32842348(confirmed onv8.1.2) - OS / Go: Windows 11 amd64,
go1.27.4 - Route: Interactions API ->
ConvertInteractionsRequestToGemini-> Gemini/Vertex/AIStudio
Minimal Reproduction & Observed vs Expected
go test -v -race -count=1 -run TestRepro_GeminiInteractionsSplitsMultipartUserInput ./internal/translator/gemini/interactions
Observed output (origin/dev 32842348):
=== RUN TestRepro_GeminiInteractionsSplitsMultipartUserInput
repro_v812_test.go:14: contents len = 2, want 1 merged user turn; out={"model":"gemini-2.5-flash","contents":[{"role":"user","parts":[{"text":"hello"}]},{"role":"user","parts":[{"text":"world"}]}]}
--- FAIL: TestRepro_GeminiInteractionsSplitsMultipartUserInput (0.00s)
| Check / Field | Observed (origin/dev 32842348) |
Expected |
|---|---|---|
len(contents) for 2-part user_input |
2 consecutive role:"user" turns |
1 merged role:"user" turn with 2 parts |
Proposed fix (internal/translator/**)
Call contentItems = translatorcommon.MergeAdjacentGeminiUserContents(contentItems) in convertInteractionsRequestToGemini (interactions_gemini_common.go:54), matching 0e981b9f in antigravity/interactions.
What ran / Not run
- Ran: Hermetic
go test -v -race -count=1 -run TestRepro_GeminiInteractionsSplitsMultipartUserInput ./internal/translator/gemini/interactionsagainstorigin/dev(32842348). - Not run: Live upstream calls.
- Dominant language
- Go
- Stars
- 58.8k
- Forks
- 9k
- Avg merge
- 14h 20m
- Merged PRs (30d)
- 67
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from router-for-me/CLIProxyAPI
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7976 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7975 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
router-for-me/CLIProxyAPI#7974 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
router-for-me/CLIProxyAPI#7973 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7971 ·
Maintainers usually reply within 1 day
All issues in router-for-me/CLIProxyAPI
Similar issues
-
A failed hydrate call can be dropped when the row's wait is ready tooPossibly taken @turbot-agent-fleet claimed this today. Openagent:ready
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
turbot/steampipe-plugin-sdk#1018 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
uselagoon/lagoon-cli#501 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
slavakurilyak/awesome-ai-agents#1026 ·