Skip to content

Conversation

@wzyfromhust
Copy link

Fix: Filter [REDACTED] placeholder in OpenRouter Gemini 3.0 Pro reasoning

Problem

When using OpenRouter with google/gemini-3-pro-preview model, two reasoning panels were displayed in the UI:

  1. First panel: Normal reasoning content (correct behavior)
  2. Second panel: Shows [REDACTED] with 0.0s duration (should NOT be displayed)
错误示例图片

Root Cause

This issue is specific to OpenRouter's Gemini 3.0 Pro Preview model.

  1. Gemini 3.0 Pro returns encrypted reasoning summary at the end of response (reasoning.encrypted)
  2. @openrouter/ai-sdk-provider transforms this into [REDACTED] placeholder
  3. Our stream processing code created an extra reasoning part when receiving this placeholder
  4. This resulted in displaying an unwanted reasoning panel in the UI

Investigation Details

Tested OpenRouter API directly and observed the response format:

[1-5]   reasoning.text chunks (normal reasoning content)
[6-18]  content chunks (response text)
[19]    reasoning.encrypted (encrypted data) ← Root cause

The SDK converts reasoning.encrypted to [REDACTED] as a placeholder for encrypted content.

Solution

Modified src/shared/models/abstract-ai-sdk.ts (lines 357-370) to filter out the [REDACTED] placeholder specifically for Gemini 3.0 Pro models:

case 'reasoning-delta':
  // Filter empty reasoning and OpenRouter Gemini 3.0 Pro encrypted reasoning placeholder
  const isGemini3ProEncrypted =
    this.modelId.includes('gemini-3-pro') && chunk.text.trim() === '[REDACTED]'

  if (chunk.text.trim() && !isGemini3ProEncrypted) {
    return {
      currentTextPart: undefined,
      currentReasoningPart: this.createOrUpdateReasoningPart(chunk.text, contentParts, currentReasoningPart),
    }
  }
  break

Model ID matching logic: The fix applies to any model ID containing gemini-3-pro, which currently matches:

  • google/gemini-3-pro-preview

Impact

  • Only affects models with gemini-3-pro in their model ID
  • ✅ All other models' reasoning functionality remains unchanged
  • ✅ Minimal code change with clear inline documentation
  • ✅ No breaking changes

Testing

Verified with OpenRouter + google/gemini-3-pro-preview:

  • ✅ Only one reasoning panel is displayed (the actual reasoning content)
  • [REDACTED] placeholder no longer creates a visible panel
  • ✅ Reasoning content displays correctly with proper timing
  • ✅ Other providers and models work normally

…ning

Fix duplicate reasoning panel issue when using OpenRouter with google/gemini-3-pro-preview.

Gemini 3.0 Pro returns encrypted reasoning summary at the end of response,
which the OpenRouter SDK converts to [REDACTED] placeholder. This caused
an extra reasoning panel to be displayed in the UI.

The fix filters out [REDACTED] specifically for models containing
'gemini-3-pro' in their model ID.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wzyfromhust
Copy link
Author

@themez

@wzyfromhust
Copy link
Author

@claude @josueggh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant