Skip to content

fix: keep pending Knowledge uploads visible after reload#25143

Open
hytg wants to merge 1 commit into
open-webui:devfrom
hytg:fix/knowledge-upload-reload-visible
Open

fix: keep pending Knowledge uploads visible after reload#25143
hytg wants to merge 1 commit into
open-webui:devfrom
hytg:fix/knowledge-upload-reload-visible

Conversation

@hytg
Copy link
Copy Markdown

@hytg hytg commented May 28, 2026

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.

This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.

Before submitting, make sure you've checked the following:

  • Linked Issue/Discussion: This PR references an existing Issue or DiscussionCloses #25031. If one does not exist, create one first. PRs without a linked issue or discussion may be closed without review.
  • Target branch: Verify that the pull request targets the dev branch. PRs targeting main will be immediately closed.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Add docs in Open WebUI Docs Repository. Document user-facing behavior, environment variables, public APIs/interfaces, or deployment steps.
  • Dependencies: Are there any new or upgraded dependencies? If so, explain why, update the changelog/docs, and include any compatibility notes. Actually run the code/function that uses updated library to ensure it doesn't crash.
  • Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Include reproducible steps to demonstrate the issue before the fix. Test edge cases (URL encoding, HTML entities, types). Take this as an opportunity to make screenshots of the feature/fix and include them in the PR description.
  • Agentic AI Code: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review AND manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Design & Architecture: Prefer smart defaults over adding new settings; use local state for ephemeral UI logic. Open a Discussion for major architectural or UX changes.
  • Git Hygiene: Keep PRs atomic (one logical change). Clean up commits and rebase on dev to ensure no unrelated commits (e.g. from main) are included. Push updates to the existing PR branch instead of closing and reopening.
  • Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

This PR fixes #25031, where an in-progress Knowledge upload can disappear from the Knowledge page after reload/remount.

The backend may still be processing the upload, but the temporary frontend row is lost. During that window, the Knowledge page can appear empty and show No content found, making the upload look lost or failed.

This PR keeps the accepted upload visible by linking the file to the Knowledge Collection before slow backend work starts, then restoring the in-progress row from the persisted Knowledge file list.

Terminology

This PR distinguishes two backend stages:

  • File-level processing: extraction/chunking/file-level embeddings for the uploaded file.
  • Knowledge-level processing: making the file available inside the target Knowledge Collection.

This PR does not add a full multi-step progress UI. It only keeps the accepted upload visible while backend work is still in progress.

Timing

Before:

upload accepted
  -> temporary UI row shown
  -> file-level processing starts
  -> reload/remount
  -> temporary UI row is lost
  -> /knowledge/files returns no row yet
  -> UI may show "No content found"
  -> backend later finishes and links/indexes the file
  -> file finally appears

After:

upload accepted
  -> file is linked to Knowledge early
  -> UI row shown
  -> file-level processing starts
  -> reload/remount
  -> /knowledge/files returns pending file row
  -> UI restores spinner/status watching
  -> backend finishes file-level + Knowledge-level work
  -> row refreshes as completed

Added

  • Status watching for persisted in-progress Knowledge files after reload/remount.

Changed

  • Knowledge uploads now restore status from persisted Knowledge file rows instead of relying only on the original upload request.
  • Knowledge file rows show a spinner for persisted in-progress file states.

Deprecated

  • None.

Removed

  • None.

Fixed

  • In-progress Knowledge uploads disappearing after reload/remount.
  • Knowledge page showing No content found while an accepted upload is still processing.
  • Duplicate Knowledge-file link attempts during backend auto-linking.
  • Stale pending Knowledge entries after processing failure.
  • Cleanup for active status stream readers/controllers on component destroy.

Security

  • None.

Breaking Changes

  • None.

Additional Information

This is intentionally a minimal bug fix.

It does not add:

  • detailed progress labels such as embedding...
  • per-step progress
  • new settings
  • a new processing architecture

The goal is only: once a Knowledge upload is accepted, the file should not disappear from the Knowledge page during backend processing.

Manual Tests

Tested with a Playwright evidence runner using a 120-page PDF (p120.pdf) and a reload/remount while backend processing was still running.

  • Upload a slow-processing file to a Knowledge Collection.
  • Reload the page while backend work is still running.
  • Confirm the pending file row remains visible after reload/remount.
  • Confirm the pending file row keeps a spinner after reload/remount.
  • Confirm the page does not show No content found for an accepted upload.
  • Wait for completion and confirm the spinner stops and the row returns to a normal file row.
  • Navigate away and back during processing; confirm the pending row is restored.
  • Confirm no duplicate file row appears.
  • Confirm non-Knowledge file uploads are unaffected by keeping the early link behavior scoped to Knowledge uploads.
  • Confirm failed processing removes the pre-linked pending row.
  • Confirm normal Knowledge upload/delete/rename still works.

Evidence:

  • Before, unpatched upstream dev image (ghcr.io/open-webui/open-webui:dev, commit 5d9a09a88a9094ebfcd249340be3aaee544b34d0): the same runner left the file outside the Knowledge file list after reload/remount.

    • Upload status: 200
    • Status stream: sent, 200, aborted by reload/remount
    • /api/v1/knowledge/{knowledge_id}/file/add: not sent by the client before interruption
    • Global Files contained uploaded file: yes
    • Knowledge file list contained uploaded file: no
    • Remount filename visible: no
  • After, patched origin/dev commit 5d9a09a88a9094ebfcd249340be3aaee544b34d0 with this patch applied locally: reload/remount during processing kept the uploaded file linked to the Knowledge Collection.

    • Upload status: 200
    • Status stream: sent, 200, aborted by reload/remount
    • /api/v1/knowledge/{knowledge_id}/file/add: not sent by the client before interruption
    • Global Files contained uploaded file: yes
    • Knowledge file list contained uploaded file: yes
    • Remount filename visible: yes
    • Remount spinner active: yes
    • Completion filename visible: yes
    • Completion spinner stopped: yes
    • Completion normal row: yes

Screenshots or Videos

  • Reloading during processing can show No content found.
before-unpatched-reload-remount-first-11s.mp4

After:

  • The pending file remains visible with a spinner after reload/remount.
after-patched-reload-remount-first-11s.mp4

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant