Summary
The smart-reindex checkpoint records every key currently present in self._indexed_docs, not only documents successfully processed by the current run. On resume, every ID in that checkpoint is skipped before the changed-file check.
As a result, an existing document that changed before the reindex, but had not yet been reached when the process stopped, can be silently skipped after resume and keep stale chunks/vectors.
Affected version: knowledge-rag==4.8.1 / tag v4.8.1 (da167a58fdc00af78d9c5b7cda6895316b5a6030).
Relevant code
Reproduction scenario
- Metadata already contains documents A, B, and C from a previous completed index.
- B changes on disk.
- A smart reindex processes A and writes a checkpoint before reaching B.
- The checkpoint contains A, B, and C because it serializes all existing metadata keys.
- Stop the process and resume.
- B is skipped solely because its ID is in
resume_doc_ids; its changed mtime/size is never checked.
Exact-tag execution of this scenario:
CHECKPOINT_IDS ['already_processed', 'changed_but_not_reached', 'unchanged']
UNPROCESSED_CHANGED_DOC_SKIPPED True
Without resume_state, the same changed document proceeds to the stale-document eviction/update path.
Expected behavior
A checkpoint should contain only documents committed by the current run, or store a reliable cursor plus the completed IDs for that run. Existing metadata IDs must not be interpreted as proof that those documents were processed before the interruption.
Impact
Resume can finish successfully, remove its checkpoint, and leave stale search results without any error or warning.
Summary
The smart-reindex checkpoint records every key currently present in
self._indexed_docs, not only documents successfully processed by the current run. On resume, every ID in that checkpoint is skipped before the changed-file check.As a result, an existing document that changed before the reindex, but had not yet been reached when the process stopped, can be silently skipped after resume and keep stale chunks/vectors.
Affected version:
knowledge-rag==4.8.1/ tagv4.8.1(da167a58fdc00af78d9c5b7cda6895316b5a6030).Relevant code
list(self._indexed_docs.keys())resume_doc_idsReproduction scenario
resume_doc_ids; its changed mtime/size is never checked.Exact-tag execution of this scenario:
Without
resume_state, the same changed document proceeds to the stale-document eviction/update path.Expected behavior
A checkpoint should contain only documents committed by the current run, or store a reliable cursor plus the completed IDs for that run. Existing metadata IDs must not be interpreted as proof that those documents were processed before the interruption.
Impact
Resume can finish successfully, remove its checkpoint, and leave stale search results without any error or warning.