mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 05:47:50 -05:00
[PR #24936] [CLOSED] fix: prevent orphaned knowledge files by ensuring atomic upload-process-link chain #131601
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/24936
Author: @paulxg12
Created: 5/20/2026
Status: ❌ Closed
Base:
dev← Head:fix/orphaned-knowledge-files📝 Commits (1)
1d7a2eafix: prevent orphaned knowledge files by ensuring atomic upload-process-link chain📊 Changes
1 file changed (+26 additions, -4 deletions)
View changed files
📝
backend/open_webui/routers/knowledge.py(+26 -4)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Closes #24807devbranch.dev, and contains no unrelated commits.Closes #24807
Description
Root cause: Knowledge upload pipeline did linking AFTER processing.
If user navigated away during the slow embedding step (5-60s), files
were orphaned in the vector DB with no relational record.
Fix (applied to both endpoints):
add_file_to_knowledge_by_id: Link file to knowledge base FIRST,then process. If processing fails, rollback the link.
add_files_to_knowledge_batch: Link all files FIRST, then process.If processing fails, rollback all links. After processing, unlink
any files that failed.
Changelog
Fixed
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.