mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #7558] Gemini requests on OpenRouter and Gemini 3.6+ Flash: final AI turn, penalties, tool-round thoughts #4202
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SpicyMarinara on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7558
Originally assigned to: @SpicyMarinara on GitHub.
An audit of how Gemini requests are built (on staging
27b4cc004, using stubbed requests only) found six gaps. Native Google AI Studio and Vertex requests for Gemini 4 Argon are fine. Most of the gaps are on OpenRouter and the other OpenAI-compatible connections, or affect the newer Gemini Flash models.1. A request can end on an AI turn on OpenRouter, NanoGPT and custom connections (major)
With
google/gemini-4-argonon OpenRouter:sends a request whose last message is the assistant's. Google says Argon rejects that: "History payloads can't end with a
modelrole turn" (https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/guides/gemini-4-argon). Native Google and Vertex already add a short user turn asking the model to continue. The OpenAI-compatible path only does this for Claude Opus 5.5 and Sonnet 5.5.2. Gemini 3.5 Flash-Lite and 3.6, 3.7 and 3.8 Flash have the same rules as Argon but none of its handling (major)
Google documents two rules for these models. A request that ends on a model turn is rejected, and so are frequency and presence penalties:
Marinara checks only for Argon, so a prefill, an empty Send after a reply, or any penalty setting fails on every connection type.
3. OpenRouter Gemini tool rounds lose the model's reasoning details (major)
When a Gemini model on OpenRouter calls a tool, the next request replays that call without the
reasoning_detailsOpenRouter returned with it. Those details carry Gemini's thought signatures. OpenRouter says to pass them back unmodified during tool calling (https://openrouter.ai/docs/guides/best-practices/reasoning-tokens). Without them, Gemini 3 has been reported to return 400. Stored chat history must stay filtered so #1097 stays fixed.4. Post-Processing = Don't Apply sends system messages mid-chat to Gemini on OpenRouter (minor)
Depth sections, the author's note and post-history sections go out as
systemmessages in the middle of the chat. OpenRouter does not document how it passes these to Gemini. A third-party report says only the last one is kept (https://github.com/pipecat-ai/pipecat/issues/3362), which could drop the main prompt and the character card.5. The Argon code comment cites a page without the prefill or penalty rules (minor)
isGeminiArgonModelcites https://ai.google.dev/gemini-api/docs/models/gemini-4-argon. The rules are in the Vertex guide: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/guides/gemini-4-argon6. Native chat drops an AI turn that has saved Gemini parts but no text (minor)
On Google AI Studio and Vertex,
chat()skips a past assistant message whose saved Gemini parts hold only thoughts or a signature. The tools path keeps such a message. This is rare.@SpicyMarinara commented on GitHub (Oct 13, 2026):
Fixed on staging by #7560. Two minor follow-ups from review (regenerating a user message, and Individual group turns, on OpenRouter/NanoGPT/custom Gemini) are being fixed in a follow-up PR.