mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-22 17:42:18 -05:00
[PR #23789] fix(files): preserve KB embeddings when reindex fails #50416
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23789
Author: @shaun0927
Created: 4/16/2026
Status: 🔄 Open
Base:
dev← Head:fix-file-reindex-loss📝 Commits (2)
b2fce41Prevent silent KB vector loss when file reindexing fails5c3b958Respect maintainer preference against new PR test files📊 Changes
2 files changed (+42 additions, -6 deletions)
View changed files
📝
backend/open_webui/routers/files.py(+10 -6)➕
backend/open_webui/utils/knowledge_collections.py(+32 -0)📄 Description
A file content update should not leave knowledge collections emptier than before. The current
/files/{id}/data/content/updateflow deletes the old KB vectors first and only then tries to rebuild them, so a rebuild failure can leave the collection empty even though the route still returns success.This changes the propagation step to:
That preserves the previously indexed chunks if the rebuild fails.
Fixes #23787
Testing
python3 -m py_compile backend/open_webui/routers/files.py backend/open_webui/utils/knowledge_collections.pyPYTHONPATH=backend PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q backend/open_webui/test/util/test_knowledge_collections.pyChangelog Entry
Description
Added
Fixed
Additional Information
#20558; it fixes the opposite failure mode where the old embeddings are deleted and the rebuild fails.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.