Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
fix(embeddings): translate error messages before sending to UI
- Import t() function from i18n module
- Wrap error messages with t() translation function in _initializeEmbedder()
- Ensures proper localization of error messages in the UI
- Falls back to original message if no translation exists
* fix: use decodeURIComponent in openFile
* feat: add error handling for decodeURIComponent and tests
- Added try-catch block around decodeURIComponent to handle invalid escape sequences
- Falls back to original path if decoding fails
- Added comprehensive unit tests for the openFile function
- Tests cover invalid URI encoding, valid encoding, and various edge cases
* fix: update test to handle dynamic workspace paths in CI
* fix: handle Windows path separators in open-file tests
---------
Co-authored-by: Vivek Soni <vivex@Viveks-MacBook-Air-2.local>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
* fix: handle null/empty custom modes files to prevent 'Cannot read properties of null' error
- Fix SimpleInstaller to ensure existingData is always an object after yaml.parse
- Fix CustomModesManager.parseYamlSafely to return empty object instead of null
- Ensure customModes array is always initialized in both install and remove operations
- Add tests for empty/null file handling scenarios
- Update existing tests to match correct behavior
* fix: handle null/undefined settings in updateModesInFile and loadModesFromFile
- Ensure settings object exists before accessing customModes property
- Initialize customModes as empty array if undefined
- Prevent 'Cannot read properties of null' error during mode import
- Add proper validation in loadModesFromFile before schema check
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
* fix: add embedder validation to prevent misleading status indicators (#4398)
* fix: address PR feedback and fix critical issues
- Fixed settings-save flow to save before validation
- Fixed Error constructor usage in scanner.ts
- Fixed segment identification in file-watcher.ts
- Added missing translation keys for embedder validation errors
* fix: add missing Ollama translation keys
- Added missing ollama.title, description, and settings keys
- Fixed translation check failure in CI/CD pipeline
- Synchronized all 17 non-English locale files
* feat: add proactive embedder validation on provider switch
- Validate embedder connection when switching providers
- Prevent misleading 'Indexed' status when embedder is unavailable
- Show immediate error feedback for invalid configurations
- Add comprehensive test coverage for validation flow
This ensures users get immediate feedback when configuring embedders,
preventing confusion when providers like Ollama are not accessible.
* fix: improve error handling and validation in code indexing process
* refactor: extract common embedder validation and error handling logic
- Created shared/validation-helpers.ts with centralized error handling utilities
- Refactored OpenAI, OpenAI-Compatible, and Ollama embedders to use shared helpers
- Eliminated duplicate error handling code across embedders
- Improved maintainability and consistency of error handling
- Fixed test compatibility in manager.spec.ts
- All 2721 tests passing
* refactor: simplify validation helpers by removing unnecessary wrapper functions
- Removed getErrorMessageForConnectionError and inlined logic into handleValidationError
- Removed isRateLimitError, logRateLimitRetry, and logEmbeddingError wrapper functions
- Updated openai.ts and openai-compatible.ts to inline rate limit checking and logging
- Reduced code complexity while maintaining all functionality
- All 311 tests continue to pass
* fix: add missing invalidResponse i18n key and fix French translation
- Added missing 'invalidResponse' key to all locale files
- Fixed French translation: changed 'and accessible' to 'et accessible'
- Ensures proper error messages are displayed when embedder returns invalid responses
* fix: restore removed score settings in webviewMessageHandler
- Restored codebaseIndexSearchMaxResults and codebaseIndexSearchMinScore settings that were unintentionally removed
- Keep embedder validation related changes
* fix: revert unintended changes to file-watcher and scanner
- Reverted point ID generation back to using line numbers instead of segmentHash
- Restored { cause: deleteError } parameter in scanner error handling
- These changes were unrelated to the embedder validation feature
---------
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
* Add description field to create_mode instructions
- Include description field in optional but recommended fields list
- Add description field to YAML example with clear guidance
- Description field already exists in ModeConfig schema but was missing from instructions
- Provides short, human-readable description of what the mode does (1-2 sentences)
* Update description field guidance to 5 words instead of 1-2 sentences
- Changed description field guidance from '1-2 sentences' to '5 words'
- Updated YAML example to show concise 5-word description
- Addresses feedback from @mrubens in PR comment #3041823916
- Update parseOpenRouterModel to always use actual max_completion_tokens from OpenRouter API
- Remove artificial restriction that only reasoning budget and Anthropic models get their actual max tokens
- Fall back to 20% of context window when max_completion_tokens is null
- Update getModelMaxOutputTokens to use same fallback logic for consistency
- Update tests to reflect new behavior
- Fixes issue where reserved tokens showed ~209k instead of actual model limits (e.g. GPT-4o: 16,384)
- Add early return in listFiles() when limit is 0 to avoid unnecessary file scanning
- Update getEnvironmentDetails() to show appropriate message when workspace files context is disabled
- Add test coverage for maxWorkspaceFiles=0 scenario
- Clean up test files to remove unnecessary mocking complexity
This optimization improves performance when users set maxWorkspaceFiles to 0, completely bypassing file system operations.
fix: restore search score threshold slider and fix value persistence (#5041)
- Add codebaseIndexSearchMinScore to WebviewMessage type definition
- Include codebaseIndexSearchMinScore in saveCodeIndexSettingsAtomic handler
- Initialize codebaseIndexSearchMinScore in ExtensionStateContext
- Fix logical OR operators to use nullish coalescing for proper 0 value handling
- Ensure search threshold values persist correctly when saving settings
This restores the deleted feature from PR #5041 and fixes the issue where
the search score threshold value was being reset upon saving.
* feat: add configurable max search results for codebase indexing (#5149)
- Add codebaseIndexSearchMaxResults to configuration schema with validation (10-1000)
- Update Qdrant client to accept maxResults parameter in search method
- Add UI slider in Experimental Settings to configure max search results
- Rename constants to DEFAULT_MAX_SEARCH_RESULTS and DEFAULT_SEARCH_MIN_SCORE for clarity
- Add translations for new setting across all 17 supported languages
- Add comprehensive test coverage for config manager, Qdrant client, and UI components
fix: settings persistence for codebase index configuration
- Add new updateCodebaseIndexConfig message type to properly merge config updates
- Update SettingsView to send entire codebaseIndexConfig object instead of just enabled flag
- Add backend handler to merge configuration updates instead of overwriting
- Add tests for the new message handler functionality
This ensures the max search results setting persists correctly when saved.
* fix: correct property name in updateCodebaseIndexConfig message
The frontend was sending 'config' but the backend expects 'codebaseIndexConfig'.
This mismatch was preventing the max search results setting from persisting.
* feat: refactor codebase index constants and update search result defaults
* feat(chat): add advanced settings for maximum search results configuration
* refactor: remove updateCodebaseIndexConfig and integrate max search results into saveCodeIndexSettingsAtomic
- Removed updateCodebaseIndexConfig message type and handler as per PR feedback
- Added codebaseIndexSearchMaxResults to codeIndexSettings type in WebviewMessage.ts
- Updated saveCodeIndexSettingsAtomic to save codebaseIndexSearchMaxResults
- Fixed SettingsView.tsx to use codebaseIndexEnabled message instead of updateCodebaseIndexConfig
* Delete webview-ui/src/components/settings/__tests__/ExperimentalSettings.spec.tsx
* refactor: remove updateCodebaseIndexConfig tests to streamline codebase indexing logic
* revert this
---------
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
* fix: resolve Go duplicate references in tree-sitter queries (#5367)
- Replace broad statement captures with function-scoped queries
- Eliminates overlapping captures that caused duplicate references
- Improves search quality and indexing performance for Go projects
- Add test to validate no duplicate line ranges are captured
- Maintains backward compatibility with existing functionality
Fixes#5367
* fix: resolve Go codebase indexing with language-specific thresholds
- Update Go tree-sitter queries to capture full declarations instead of just identifiers
- Implement language-specific character thresholds (50 chars for Go vs 100 default)
- Fix inspectGo.spec.ts test to match new query behavior
- Add comprehensive test coverage for Go indexing fix
This ensures Go files are properly indexed for semantic search while preventing
duplicate references. All tests now pass.
* fix: implement universal 50-character threshold for code indexing
- Changed MIN_BLOCK_CHARS from 100 to 50 in parser.ts
- Updated tests to expect single-block captures for small Go files
- Removed language-specific threshold logic
- Fixes Go files not being indexed due to high character threshold
Fixes#5367
* test: replace Go-specific test with generic MIN_BLOCK_CHARS test
- Remove go-indexing-fix.spec.ts as requested in PR feedback
- Add generic test in parser.spec.ts to verify 50-character threshold
- Test ensures content under 50 chars is filtered, 50+ chars is indexed
- Applies to all languages, not just Go
* fix: update markdown tests for MIN_BLOCK_CHARS change from 100 to 50