Repository navigation
fix: isolate RAG corpus vector lifecycles and publish consistent snapshots - #302
Open
Cookie0103 wants to merge 2 commits into
Open
Cookie0103 wants to merge 2 commits into
Cookie0103 wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
RAG corpora currently own different LlamaIndex document catalogs but share one FAISS backend. A query can select vectors from another corpus, and replacing/deleting duplicate external node IDs can affect the wrong corpus. Failed updates can remove the old vector before embedding succeeds, while repeated snapshot loads append duplicate backend state.
This repairs the vector-corpus lifecycle across ingestion, retrieval, deletion and persistence:
Validation: 307 tests passed in the full suite, including 65 RAG/storage tests and real local FAISS flat/IVF tests with deterministic embeddings. The original implementation fails all 17 selected lifecycle reproductions. Independent review caught and verified a registry-lock regression: the same 20 ms async heartbeat improved from about 416 ms to 21 ms while another corpus was embedding. New event-order and lifecycle writer tests verify the repair. No paid provider requests were used.
Incremental write measurements journaled only three catalog keys at both 1,000 and 5,000 existing nodes; native vector corpora are not cloned. LlamaIndex's existing full index-ID mapping serialization still contributes O(corpus size) metadata cost.
Compatibility notes: direct
VectorIndexing.insert_nodesnow propagates the original failure;RAGEngine.addretains its existing empty-list failure result. New file snapshots retain older content generations for readers already using them, so repeated saves accumulate files. Existing graph-backend transaction boundaries remain unchanged. The configured vector backend is now a template for isolated corpus stores.Prepared with AI assistance.