mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5904] Gemini reasoning turns never stream because a proxy workaround is applied to every connection #3261
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#3261
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 @kolacheee on GitHub (Sep 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5904
Originally assigned to: @SpicyMarinara on GitHub.
When a Gemini connection has reasoning enabled, no turn ever streams. The provider
forces the buffered
generateContentendpoint whenever a thinking config is present —useStreaming = options.stream && !thinkingConfig(
packages/server/src/services/llm/providers/google.provider.ts:691-694) — so theuser watches a silent screen for the whole generation and then gets the entire reply
at once. Reasoning turns are the longest turns a model produces, so the buffering
lands exactly where streaming matters most; a long thinking turn with no tokens
arriving is indistinguishable from a hang.
Where it comes from, and why it exists. The comment above the line says it plainly:
"proxies like linkapi.ai strip thought parts from SSE streams but return them in
non-streaming responses." Thought parts matter beyond display — the provider stores a
model turn's Gemini parts, including thought signatures, and replays them on later
turns to preserve reasoning state (
google.provider.ts:708-712), so a stream thatsilently drops them degrades every subsequent turn of the chat. For a user on one of
those proxies, the buffering is genuinely the right call.
The problem is the scope. The workaround is applied to every connection,
unconditionally. A user pointed directly at
generativelanguage.googleapis.com—where the streaming endpoint returns thought parts correctly — pays the same
full-generation buffering as a user behind a thought-stripping proxy. The engine
already knows proxies are common here (
normalizeGoogleGenerativeLanguageBaseUrlexists precisely to fix up proxy base URLs), but it never distinguishes them from the
official endpoint.
Why it matters to a user. Reasoning is a per-connection setting someone deliberately
turns on to get better answers; the hidden price today is that their app stops
feeling alive on every turn. Nothing in the UI explains it, so the natural readings
are "Gemini is slow" or "the app is stuck" — a support burden shaped exactly like a
bug report, for behavior that is actually a compatibility choice made on behalf of a
proxy the user may not even use.
The smallest honest fix is to scope the workaround rather than remove it. Several
shapes would do it, each with a real tradeoff worth weighing: a per-connection
"proxy compatibility" setting (explicit, but one more knob to explain); defaulting by
endpoint (stream when the base URL is the official Google endpoint, buffer for
anything unrecognized — zero-knob, but wrong for a well-behaved proxy); or optimistic
streaming with sticky fallback (stream the turn, and if expected thought parts come
back missing, warn once and buffer subsequent thinking turns on that connection —
self-correcting, but the first turn on a stripping proxy loses its thought parts).
Whichever lands, the in-progress provider streaming-with-tools work deliberately
inherits today's rule untouched, so both paths should pick up the scoping from this
issue rather than each inventing their own.
@SpicyMarinara commented on GitHub (Sep 8, 2026):
Codex is taking #5904 for @SpicyMarinara in the assigned-issue sweep. The
stagingfix will scope the existing reasoning-buffer workaround to proxy endpoints and keep both ordinary and tool-calling Gemini turns on the same policy. No extra user setting is needed.