From d4a4e1c0ba7da9a2b3fc8342a0b56adc9c6fe98e Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 19 Nov 2025 17:02:42 +0000 Subject: [PATCH] fix: prevent Gemini 3 Pro internal thoughts from being displayed to users - Added check for gemini-3-pro-preview model when processing thought parts - Thoughts from Gemini 3 Pro are now filtered out and not yielded as reasoning chunks - This prevents internal reasoning text from appearing in the UI Fixes #9398 --- src/api/providers/gemini.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/providers/gemini.ts b/src/api/providers/gemini.ts index f54a3edb5d..953ec6a371 100644 --- a/src/api/providers/gemini.ts +++ b/src/api/providers/gemini.ts @@ -81,6 +81,9 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl ? (this.options.modelMaxTokens ?? maxTokens ?? undefined) : (maxTokens ?? undefined) + // Check if this is Gemini 3 Pro model - its thoughts should not be shown to users + const isGemini3Pro = model === "gemini-3-pro-preview" + // Only forward encrypted reasoning continuations (thoughtSignature) when we are // using reasoning (thinkingConfig is present). Both effort-based (thinkingLevel) // and budget-based (thinkingBudget) models require this for active loops. @@ -170,7 +173,9 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl if (part.thought) { // This is a thinking/reasoning part - if (part.text) { + // For Gemini 3 Pro models, we skip yielding reasoning chunks + // to prevent internal thoughts from being shown to users + if (part.text && !isGemini3Pro) { yield { type: "reasoning", text: part.text } } } else {