restore() marks its background task completed when every vector rebuild failed
restore() marks its background task completed when every vector rebuild failed
Bug Description
VikingFS.restore can rebuild vectors for the restored tree in the background and report progress through a tracked task. _run_restore_rebuild_tracked (openviking/storage/viking_fs/_snapshot.py) launches one _run_vector_rebuild per (op, uri, level) with asyncio.gather, then unconditionally completes the task:
await asyncio.gather(*[self._run_vector_rebuild(...) for (op, uri, level) in tasks])
await tracker.complete(...)
_run_vector_rebuild catches every exception, logs it, and returns normally. A failed deletion or reindex is therefore invisible to the gather, and the tracked task ends with {"status": "completed", "task_count": N} even when none of the N vector operations succeeded.
Steps to Reproduce
- Create a snapshot of a tree and restore it with background vector rebuild enabled (the tracked variant used by
restore()). - Make the per-file vector operation fail, e.g. have the vector-store delete/upsert raise.
- Poll the returned task.
Expected Behavior
The task ends in a failed state that names the failure, so a caller waiting for the restore to become searchable does not treat stale vectors as success. Every task is still attempted before the overall task is failed.
Actual Behavior
The tracked task is marked completed with the full task count, while the vectors were never rebuilt. Polling callers proceed as if the restored tree is fully indexed.
Environment
- OS: Windows 11
- OpenViking version/commit: main @
37a74437
Additional Context
Fix submitted as PR #7564: _run_vector_rebuild reports success as a boolean, _run_restore_rebuild_tracked collects the results and fails the tracked task with "N of M vector rebuild task(s) failed; restored vectors may still be stale". The fire-and-forget path is unchanged. The regression test fails on unmodified main and passes with the fix; a second test pins the all-success payload.