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
This commit is contained in:
Roo Code 2025-11-19 17:02:42 +00:00
parent 18c4d1ac41
commit d4a4e1c0ba

View file

@ -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 {