feat: Auto-heal for silent semantic search failure#8
Merged
PatrickSys merged 4 commits intomasterfrom Jan 6, 2026
Merged
Conversation
Greptile SummaryImplements an auto-heal mechanism to detect and recover from LanceDB vector index corruption by triggering automatic re-indexing when schema validation fails or the vector column is missing. Key Changes:
Concern: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MCP as MCP Server (index.ts)
participant Searcher as CodebaseSearcher
participant Storage as LanceDBStorage
participant Indexer as CodebaseIndexer
User->>MCP: search_codebase(query)
MCP->>Searcher: search(query, limit, filters)
Searcher->>Searcher: initialize()
Searcher->>Storage: initialize(storagePath)
alt Table exists but corrupted
Storage->>Storage: openTable('code_chunks')
Storage->>Storage: validate schema
Storage-->>Storage: Missing vector column detected
Storage->>Storage: dropTable('code_chunks')
Storage-->>Searcher: throw IndexCorruptedError
Searcher-->>MCP: throw IndexCorruptedError
else Search on corrupted index
Storage->>Storage: vectorSearch(queryVector)
Storage-->>Storage: "No vector column" error
Storage-->>Searcher: throw IndexCorruptedError
Searcher-->>MCP: throw IndexCorruptedError
end
MCP->>MCP: catch IndexCorruptedError
MCP->>MCP: console.error('[Auto-Heal] Index corrupted')
MCP->>Indexer: performIndexing()
Indexer->>Indexer: index files and rebuild vector DB
Indexer-->>MCP: indexState.status = 'ready'
MCP->>MCP: Check if indexing succeeded
alt Indexing succeeded
MCP->>MCP: console.error('[Auto-Heal] Success')
MCP->>Searcher: new CodebaseSearcher(ROOT_PATH)
MCP->>Searcher: search(query, limit, filters)
Searcher->>Storage: search with fresh index
Storage-->>Searcher: results
Searcher-->>MCP: results
MCP-->>User: Success response with results
else Indexing failed
MCP-->>User: Error: Auto-heal failed
end
|
- Keep schema validation in initialize() where it belongs - Only trigger auto-heal for verified 'no vector column' pattern - Remove complex verifyTableHealth() method (48 fewer lines) - Add test for graceful degradation on transient errors - Gracefully degrade to keyword search for unknown errors Addresses Greptile code review feedback on PR #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements an auto-heal mechanism to resolve the issue where Semantic Search would silently fail after LanceDB tables becoming corrupted. This degraded the performance of the MCP Server by defaulting to keyword-based search
Changes
Testing