feat: Auto-heal for silent semantic search failure#7
feat: Auto-heal for silent semantic search failure#7PatrickSys wants to merge 2 commits intomasterfrom
Conversation
Greptile SummaryImplements automatic corruption detection and healing for LanceDB semantic search failures. When the vector database schema is corrupted (missing vector column), the system now throws Key Changes
Potential Issues
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MCP as MCP Server
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 schema invalid
Storage->>Storage: Check schema for vector column
Storage-->>Storage: Missing vector column detected
Storage->>Storage: dropTable('code_chunks')
Storage-->>Searcher: throw IndexCorruptedError
Searcher-->>MCP: throw IndexCorruptedError
else Table missing
Storage->>Searcher: search() called with no table
Storage-->>Searcher: throw IndexCorruptedError
Searcher-->>MCP: throw IndexCorruptedError
end
MCP->>MCP: Catch IndexCorruptedError
MCP->>MCP: Log "[Auto-Heal] Index corrupted..."
MCP->>Indexer: performIndexing()
Indexer->>Indexer: index() - full re-index
Indexer->>Storage: store(chunks with embeddings)
Storage->>Storage: createTable('code_chunks')
Indexer-->>MCP: indexing complete
alt Re-indexing successful
MCP->>MCP: Check indexState.status === 'ready'
MCP->>Searcher: new CodebaseSearcher(ROOT_PATH)
MCP->>Searcher: search(query, limit, filters)
Searcher->>Storage: search(queryVector, limit)
Storage-->>Searcher: results
Searcher-->>MCP: SearchResult[]
MCP-->>User: Success response with results
else Re-indexing failed
MCP-->>User: Error response (auto-heal failed)
end
|
| if (error instanceof Error && (error.message.includes('LanceDB') || error.message.includes('Arrow'))) { | ||
| throw new IndexCorruptedError(`LanceDB runtime error: ${error.message}`); |
There was a problem hiding this comment.
logic: Overly broad error catching - any error matching "LanceDB" or "Arrow" triggers auto-heal
This catch-all may cause unnecessary re-indexing for transient network issues, OOM errors, or other non-corruption problems. Consider narrowing to specific error types or adding additional validation before throwing IndexCorruptedError.
| if (error instanceof Error && (error.message.includes('LanceDB') || error.message.includes('Arrow'))) { | |
| throw new IndexCorruptedError(`LanceDB runtime error: ${error.message}`); | |
| if (error instanceof Error && error.message.includes('No vector column')) { | |
| throw new IndexCorruptedError('LanceDB index corrupted: missing vector column'); | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/storage/lancedb.ts
Line: 192:193
Comment:
**logic:** Overly broad error catching - any error matching "LanceDB" or "Arrow" triggers auto-heal
This catch-all may cause unnecessary re-indexing for transient network issues, OOM errors, or other non-corruption problems. Consider narrowing to specific error types or adding additional validation before throwing `IndexCorruptedError`.
```suggestion
if (error instanceof Error && error.message.includes('No vector column')) {
throw new IndexCorruptedError('LanceDB index corrupted: missing vector column');
}
```
How can I resolve this? If you propose a fix, please make it concise.|
Closing in favor of a new PR with proper branch naming. See the new PR for this feature. |
Description
This PR implements an auto-heal mechanism to resolve the 'Silent Semantic Search Failure' issue.
Changes
Testing