[PR #24935] [CLOSED] fix: prevent orphaned knowledge files by ensuring atomic upload-process-link chain #131600

Closed
opened 2026-05-21 17:18:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24935
Author: @paulxg12
Created: 5/20/2026
Status: Closed

Base: devHead: fix/orphaned-knowledge-files


📝 Commits (1)

  • 1d7a2ea fix: 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

Closes #24807

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):

  • : Link file to knowledge base FIRST,
    then process. If processing fails, rollback the link.
  • : Link all files FIRST, then process.
    If processing fails, rollback all links. After processing, unlink
    any files that failed.

This makes the upload-process-link chain atomic — either everything
succeeds or the knowledge base stays clean.

Testing:

  • Existing tests pass (no behavioral change for success path)
  • Manual verification: files that fail processing are properly
    unlinked from the knowledge base

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24935 **Author:** [@paulxg12](https://github.com/paulxg12) **Created:** 5/20/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/orphaned-knowledge-files` --- ### 📝 Commits (1) - [`1d7a2ea`](https://github.com/open-webui/open-webui/commit/1d7a2ea215f8f67f5af911dd86cb08381f6b7e43) fix: prevent orphaned knowledge files by ensuring atomic upload-process-link chain ### 📊 Changes **1 file changed** (+26 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/knowledge.py` (+26 -4) </details> ### 📄 Description Closes #24807 **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): - : Link file to knowledge base FIRST, then process. If processing fails, rollback the link. - : Link all files FIRST, then process. If processing fails, rollback all links. After processing, unlink any files that failed. This makes the upload-process-link chain atomic — either everything succeeds or the knowledge base stays clean. **Testing**: - Existing tests pass (no behavioral change for success path) - Manual verification: files that fail processing are properly unlinked from the knowledge base --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:18:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131600