Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jul 10, 2025

Closes #5572

Problem

When validating embedder configurations, if an error occurs and its corresponding translation key is not found, the system was incorrectly displaying the raw translation key (e.g., "embeddings:validation.configurationError") to the user. This was caused by flawed fallback logic in src/services/code-index/manager.ts.

Solution

This PR corrects the translation fallback logic. The code now checks if the i18next translation function returns the original key. If it does, it correctly uses the original error message as a fallback, ensuring a meaningful error message is always displayed to the user.


Important

Fixes translation fallback logic for embedding errors and updates related translations and tests.

  • Behavior:
    • Fixes translation fallback logic in manager.ts to use original error message if translation key is not found.
    • Adds new translation keys apiKeyRequired and baseUrlRequired in embeddings.json for multiple languages.
  • Tests:
    • Updates tests in gemini.spec.ts and openai-compatible.spec.ts to expect new error messages validation.apiKeyRequired and validation.baseUrlRequired.
  • Misc:
    • Updates validation-helpers.ts to use t() for error messages.

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

@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners July 10, 2025 17:33
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 10, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jul 10, 2025

No security or compliance issues detected. Reviewed everything up to 63ebdf3.

Security Overview
  • 🔎 Scanned files: 24 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► embeddings.json
    Added new validation messages for API key and base URL requirements
► gemini.spec.ts
    Updated error message tests
► openai-compatible.spec.ts
    Updated validation error handling
► McpToolRow.tsx
    Modified tool visualization interface
► McpView.tsx
    Updated server toggle UI
► validation-helpers.ts
    Enhanced error message handling

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 10, 2025
@daniel-lxs daniel-lxs marked this pull request as draft July 10, 2025 17:37
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@daniel-lxs daniel-lxs force-pushed the fix/issue-5572-translation-fallback branch from 1f71af1 to 6c5b36d Compare July 10, 2025 17:56
… translation keys

- Remove complex fallback logic from manager.ts since errors should be translated at source
- Update tests to expect translation keys as returned by t() function in test environment
- This ensures consistent behavior between test and production environments
@daniel-lxs daniel-lxs marked this pull request as ready for review July 10, 2025 18:40
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 10, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jul 10, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
daniel-lxs and others added 3 commits July 10, 2025 13:47
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@daniel-lxs
Copy link
Member Author

Mocked both ollama and openAI compatible, the error is now properly shown:

image image

@mrubens mrubens merged commit 50598b2 into main Jul 10, 2025
11 checks passed
@mrubens mrubens deleted the fix/issue-5572-translation-fallback branch July 10, 2025 19:47
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 10, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 10, 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 lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Embeddings Feature is very rigid

4 participants