open-webui/backend/open_webui/utils
JunghwanNA b2fce411c8 Prevent silent KB vector loss when file reindexing fails
A file content update should not leave knowledge collections emptier than before. The previous flow deleted old vectors first and then attempted the rebuild, so any downstream processing failure could leave the KB without embeddings even though the route returned success.\n\nThis change rebuilds the file's knowledge entries first and only deletes the stale vector ids after the new insert succeeds. The fix is kept narrow to the file-update propagation path and adds a focused regression test for the helper that preserves old ids when reindexing raises.\n\nConstraint: Keep the fix scoped to one retrieval correctness bug without refactoring broader embedding flows\nRejected: Fail the route after deleting old vectors | still leaves the KB empty and does not preserve data\nRejected: Broad temporary-collection refactor | larger than needed for a first bugfix PR\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Preserve old vector ids until rebuild success remains observable in tests; do not revert to delete-first ordering\nTested: py_compile on modified modules; PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=backend pytest -q backend/open_webui/test/util/test_knowledge_collections.py; local source-faithful harness reproducing old failure mode\nNot-tested: Full application boot with live vector database backends
2026-04-16 21:20:34 +09:00
..
access_control refac: async db 2026-04-12 14:22:11 -05:00
images refac 2026-04-15 10:17:40 -07:00
mcp refac: async db 2026-04-12 14:22:11 -05:00
telemetry refac: async db 2026-04-12 14:22:11 -05:00
actions.py refac: async db 2026-04-12 14:22:11 -05:00
anthropic.py chore: format 2026-04-14 17:27:31 -05:00
asgi_middleware.py chore: format 2026-04-14 17:27:31 -05:00
audit.py refac 2026-04-12 16:25:01 -05:00
auth.py chore: format 2026-04-12 18:12:59 -05:00
automations.py refac 2026-04-13 21:29:03 -05:00
channels.py refac 2026-03-17 17:58:01 -05:00
chat.py refac: async db 2026-04-12 14:22:11 -05:00
code_interpreter.py refac 2026-03-17 17:58:01 -05:00
embeddings.py refac: async db 2026-04-12 14:22:11 -05:00
files.py refac 2026-04-14 10:55:11 -05:00
filter.py refac: async db 2026-04-12 14:22:11 -05:00
groups.py refac: async db 2026-04-12 14:22:11 -05:00
headers.py refac 2026-03-17 17:58:01 -05:00
knowledge_collections.py Prevent silent KB vector loss when file reindexing fails 2026-04-16 21:20:34 +09:00
logger.py refac 2026-04-10 10:15:55 -07:00
middleware.py refac 2026-04-15 10:37:59 -07:00
misc.py refac 2026-04-14 01:17:39 -05:00
models.py refac: async db 2026-04-12 14:22:11 -05:00
oauth.py chore: format 2026-04-14 17:27:31 -05:00
payload.py refac 2026-04-14 16:47:43 -05:00
pdf_generator.py refac 2026-03-17 17:58:01 -05:00
plugin.py refac: async db 2026-04-12 14:22:11 -05:00
rate_limit.py refac 2026-03-17 17:58:01 -05:00
redis.py chore: format 2026-04-12 18:12:59 -05:00
response.py refac 2026-03-24 04:49:48 -05:00
sanitize.py refac 2026-03-17 17:58:01 -05:00
security_headers.py refac 2026-03-17 17:58:01 -05:00
session_pool.py refac 2026-04-14 01:17:39 -05:00
task.py fix: Fix the error that occurs when the task model does not exist (#23169) 2026-04-01 07:01:25 -05:00
tools.py chore: format 2026-04-12 22:11:10 -05:00
validate.py chore: format 2026-04-12 18:12:59 -05:00
webhook.py refac 2026-03-24 04:49:48 -05:00