Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Nov 4, 2025

This PR addresses Issue #9026 where codebase indexing fails with custom providers using different model ID casing.

Problem

Users with custom providers (e.g., OpenRouter) using model IDs with different casing than defined in our profiles (like Qwen/Qwen3-Embedding-8B vs qwen/qwen3-embedding-8b) were experiencing indexing failures. While regular Roo Code operations worked, the embedding model dimension lookup failed silently, preventing codebase indexing.

Solution

  • Updated getModelDimension(), getModelScoreThreshold(), and getModelQueryPrefix() in embeddingModels.ts to perform case-insensitive model ID matching
  • Uses Object.keys().find() with .toLowerCase() for comparison while preserving original profile keys

Testing

  • Added comprehensive test suite in embeddingModels.spec.ts with 22 tests
  • Tests cover all three functions with various case permutations
  • Includes specific tests for the exact Qwen model casing reported in the issue
  • All existing tests continue to pass, ensuring backward compatibility

Impact

  • Fixes the reported indexing issue for custom providers using different model ID casing
  • Improves user experience by making model configuration more forgiving
  • Maintains full backward compatibility with existing lowercase model IDs
  • No security implications or breaking changes

Fixes #9026

Feedback and testing welcome! This should resolve the indexing issue, but if the problem persists, there may be additional factors to investigate.


Important

This PR makes model ID matching case-insensitive in embeddingModels.ts to fix indexing issues with custom providers, adding comprehensive tests for validation.

  • Behavior:
    • getModelDimension(), getModelScoreThreshold(), and getModelQueryPrefix() in embeddingModels.ts now perform case-insensitive model ID matching using .toLowerCase().
    • Uses Object.keys().find() to preserve original profile keys.
  • Testing:
    • Added 22 tests in embeddingModels.spec.ts to cover case-insensitive matching for all three functions.
    • Includes tests for specific Qwen model casing and various case permutations.
  • Impact:
    • Fixes indexing issue for custom providers with different model ID casing.
    • Maintains backward compatibility with existing lowercase model IDs.

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

- Updated getModelDimension, getModelScoreThreshold, and getModelQueryPrefix to perform case-insensitive matching
- Fixes issue where custom providers using different casing (e.g., Qwen/Qwen3-Embedding-8B) were not recognized
- Added comprehensive tests for case-insensitive model matching

Fixes #9026
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 4, 2025 16:56
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Nov 4, 2025
@roomote
Copy link
Author

roomote bot commented Nov 4, 2025

See this task on Roo Code Cloud

Review complete. The implementation correctly addresses the case-insensitive model ID matching issue with comprehensive test coverage. No issues found.

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

const lowerModelId = modelId.toLowerCase()

// Find the model profile with case-insensitive matching
const modelProfile = Object.keys(providerProfiles).find((key) => key.toLowerCase() === lowerModelId)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming the variable used for the found key in getModelDimension from modelProfile to something like modelProfileKey for consistency with the similar functions below.

}

const modelProfile = providerProfiles[modelId]
// Convert modelId to lowercase for case-insensitive comparison
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case-insensitive key lookup logic is repeated in getModelDimension, getModelScoreThreshold, and getModelQueryPrefix. Consider extracting this common logic into a helper function to reduce duplication.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 4, 2025
@daniel-lxs daniel-lxs closed this Nov 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 5, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 5, 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:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] The codebase indexing doesn't work

4 participants