Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 24, 2025

Description

This PR clarifies and fixes the guard that determines whether to send thinkingConfig to Gemini models. Previously, the guard only checked for maxThinkingTokens or supportsReasoningBudget, which caused models with supportsReasoningEffort (but not the other properties) to incorrectly be blocked from receiving thinkingConfig.

Key changes:

  • Updated the supportsThinkingConfig guard to also check for model.supportsReasoningEffort
  • Clarified the comment explaining why this guard exists (to prevent Gemini 3 models from receiving the field and returning 400 INVALID_ARGUMENT errors)
  • Added comment explaining that models must advertise support before we send thinkingConfig

This ensures:

  • Gemini 2.5 models with budget support continue to work correctly
  • Gemini models with effort support receive the appropriate thinkingConfig
  • Gemini 3 models (without any thinking support flags) dont receive thinkingConfig and avoid 400 errors

Test Procedure

  1. Ran reasoning tests: cd src && npx vitest run api/transform/__tests__/reasoning.spec.ts --reporter dot
    • All 57 tests pass
  2. Ran lint checks: pnpm lint
    • No errors
  3. Verified type checking passes

Pre-Submission Checklist

  • Scope: Changes are focused on the Gemini reasoning configuration guard
  • Self-Review: Code has been thoroughly reviewed
  • Testing: All existing tests pass (57/57)
  • Documentation Impact: No user-facing documentation updates required

Documentation Updates

  • No documentation updates are required.

View task on Roo Code Cloud


Important

Fix thinkingConfig guard in getGeminiReasoning to correctly handle models with supportsReasoningEffort and prevent 400 errors for unsupported models.

  • Behavior:
    • Update supportsThinkingConfig guard in getGeminiReasoning in reasoning.ts to check for model.supportsReasoningEffort.
    • Ensure Gemini models with supportsReasoningEffort receive thinkingConfig.
    • Prevent Gemini 3 models from receiving thinkingConfig to avoid 400 errors.
  • Tests:
    • Add test in reasoning.spec.ts for models with fixed reasoningEffort but no supportsReasoningEffort.
    • Add test for models without any thinking support (e.g., Gemini 3) to ensure they don't receive thinkingConfig.

This description was created by Ellipsis for f3dede7. You can customize this summary. It will automatically update as commits are pushed.

@roomote roomote bot requested review from cte, jr and mrubens as code owners December 24, 2025 20:30
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Dec 24, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 24, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 24, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 24, 2025

Updated the PR to support models with fixed reasoning levels.

Additional change:
Added !!model.reasoningEffort to the supportsThinkingConfig guard. This ensures models that have a fixed/default reasoning level (without UI controls) can still send thinkingConfig to Gemini.

Rationale:

  • model.supportsReasoningEffort controls UI visibility (show the dropdown selector)
  • model.reasoningEffort can be set as a fixed default independently
  • Some models may have hardcoded reasoning levels without exposing UI controls

This prevents blocking valid models while still protecting against Gemini 3 models that don't support thinking at all.

Tests:

  • All 57 reasoning tests pass ✓
  • Lint checks pass ✓
  • Type checking passes ✓

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants