Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jan 16, 2026

Summary

Fixes the "Corrupted thought signature" error when using LiteLLM with Gemini 3/2.5 models via model groups that use space-separated names (e.g., "Gemini 3 Pro").

Problem

LiteLLM model groups can use space-separated model names like "Gemini 3 Pro" instead of hyphenated names like "gemini-3-pro". The isGeminiModel() function only matched hyphenated names, causing the thought signature injection to be skipped for space-separated names.

When Vertex AI receives a Gemini 3 request without the expected thought signature, it returns:

"Corrupted thought signature." 
"status": "INVALID_ARGUMENT"

Solution

Updated isGeminiModel() to detect both naming conventions:

  • Added checks for space-separated patterns: gemini 3, gemini 2.5
  • Updated regex to match both hyphens and spaces in provider-prefixed patterns

Changes

  • src/api/providers/lite-llm.ts: Updated isGeminiModel() function
  • src/api/providers/tests/lite-llm.spec.ts: Added tests for space-separated model names

Testing

All 19 LiteLLM handler tests pass including new tests for:

  • "Gemini 3 Pro" (title case with spaces)
  • "Gemini 3 Flash" (title case with spaces)
  • "gemini 3 pro" (lowercase with spaces)
  • "Gemini 2.5 Pro" (Gemini 2.5 variant)
  • "google/gemini 3 pro" (provider-prefixed with spaces)
  • "vertex_ai/gemini 2.5 pro" (provider-prefixed with spaces)

Closes COM-508


Important

Fixes isGeminiModel() in lite-llm.ts to detect Gemini models with space-separated names, adding tests in lite-llm.spec.ts.

  • Behavior:
    • Fixes detection of Gemini models with space-separated names in isGeminiModel() in lite-llm.ts.
    • Handles both hyphenated and space-separated naming conventions for Gemini 3 and 2.5 models.
  • Testing:
    • Adds tests in lite-llm.spec.ts for space-separated Gemini model names, including provider-prefixed variants.
    • Verifies detection of models like "Gemini 3 Pro", "gemini 3 pro", and "vertex_ai/gemini 2.5 pro".
  • Misc:
    • Updates regex in isGeminiModel() to match both hyphens and spaces.

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

…ught signature injection

The isGeminiModel() function only matched hyphenated model names (e.g., gemini-3-pro)
but LiteLLM model groups can use space-separated names like 'Gemini 3 Pro'.

When the model isn't detected as Gemini, thought signatures aren't injected into
the request, causing 'Corrupted thought signature' errors from the Vertex AI API.

Changes:
- Added lowerModelId.includes('gemini 3') and lowerModelId.includes('gemini 2.5')
  for space-separated model names
- Updated provider-prefixed regex to match both hyphens and spaces
- Added tests for space-separated model name detection

Closes COM-508
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners January 16, 2026 22:15
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jan 16, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 16, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The changes correctly extend isGeminiModel() to detect space-separated Gemini model names from LiteLLM model groups. The implementation follows existing patterns in the codebase and includes comprehensive test coverage. All 19 tests pass.

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

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 16, 2026
@mrubens mrubens closed this Jan 16, 2026
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 16, 2026
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 16, 2026
@mrubens mrubens reopened this Jan 16, 2026
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Jan 16, 2026
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Jan 16, 2026
@mrubens mrubens merged commit 95be704 into main Jan 16, 2026
30 of 31 checks passed
@mrubens mrubens deleted the feature/com-508-fix-litellm-gemini-thought-signature-detection-for-space branch January 16, 2026 22:43
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 16, 2026
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 16, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 16, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The changes correctly extend isGeminiModel() to detect space-separated Gemini model names from LiteLLM model groups. The implementation is sound and includes comprehensive test coverage for all variations (title case, lowercase, and provider-prefixed patterns).

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

@mrubens mrubens mentioned this pull request Jan 16, 2026
@roomote roomote bot mentioned this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants