[GH-ISSUE #5918] Attaching any tool silently stops streaming on Gemini and Anthropic connections #3273

Closed
opened 2026-10-21 06:01:35 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Sep 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5918

Originally assigned to: @kolacheee on GitHub.

When any tool is attached to a generation, the Gemini and Anthropic adapters silently
stop streaming: the whole reply is buffered and arrives at once, on every turn of any
chat with tools enabled — not just turns that actually call a tool. The user watches an
empty bubble for the full generation time.

Where it is. The Gemini adapter takes the non-streaming generateContent endpoint
whenever tools are present (packages/server/src/services/llm/providers/google.provider.ts:578-581,
with a single onToken at the end), and the Anthropic adapter hardcodes stream: false
in its tools branch (anthropic.provider.ts:386). Neither provider's API requires this —
both stream tool calls natively — and the OpenAI-compatible adapter already streams with
tools attached. The generation loop itself streams round-one prose live through onToken
and never passes a stream flag, so nothing route-side forces the buffering either.

Why it matters. Tool use is about to become a normal part of Game Mode (the GM rolling
real dice), and today the price of enabling it on the two most common connection kinds is
losing live streaming everywhere. Time-to-first-token is the whole feel of a streaming
chat; a feature that silently trades it away chat-wide will read as "the app got slower"
with no visible cause.

The smallest honest fix is to implement the streaming path inside each adapter's
tools-aware completion (mirroring the OpenAI adapter's shape: stream when a token
callback is present unless the caller explicitly opted out), leaving untouched the
deliberate exception where Gemini with reasoning enabled stays buffered for the proxy
reason #5904 covers. PR to follow.

Originally created by @kolacheee on GitHub (Sep 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5918 Originally assigned to: @kolacheee on GitHub. When any tool is attached to a generation, the Gemini and Anthropic adapters silently stop streaming: the whole reply is buffered and arrives at once, on every turn of any chat with tools enabled — not just turns that actually call a tool. The user watches an empty bubble for the full generation time. Where it is. The Gemini adapter takes the non-streaming `generateContent` endpoint whenever tools are present (`packages/server/src/services/llm/providers/google.provider.ts:578-581`, with a single `onToken` at the end), and the Anthropic adapter hardcodes `stream: false` in its tools branch (`anthropic.provider.ts:386`). Neither provider's API requires this — both stream tool calls natively — and the OpenAI-compatible adapter already streams with tools attached. The generation loop itself streams round-one prose live through `onToken` and never passes a `stream` flag, so nothing route-side forces the buffering either. Why it matters. Tool use is about to become a normal part of Game Mode (the GM rolling real dice), and today the price of enabling it on the two most common connection kinds is losing live streaming everywhere. Time-to-first-token is the whole feel of a streaming chat; a feature that silently trades it away chat-wide will read as "the app got slower" with no visible cause. The smallest honest fix is to implement the streaming path inside each adapter's tools-aware completion (mirroring the OpenAI adapter's shape: stream when a token callback is present unless the caller explicitly opted out), leaving untouched the deliberate exception where Gemini with reasoning enabled stays buffered for the proxy reason #5904 covers. PR to follow.
bsakaguchi 2026-10-21 06:01:35 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 8, 2026):

Maintainer follow-up: @SpicyMarinara (Codex) is addressing CI and CodeRabbit findings on the existing @kolacheee PR #5920, then validating it for staging. The live-provider verification requirement is being checked separately; no live API results are claimed yet.

<!-- gh-comment-id:5581941926 --> @SpicyMarinara commented on GitHub (Sep 8, 2026): Maintainer follow-up: @SpicyMarinara (Codex) is addressing CI and CodeRabbit findings on the existing @kolacheee PR #5920, then validating it for staging. The live-provider verification requirement is being checked separately; no live API results are claimed yet.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3273
No description provided.