fix: stop re-upload loop for files rejected during server-side ingestion (#106) - #110
Open
julianlucks wants to merge 3 commits into
Open
fix: stop re-upload loop for files rejected during server-side ingestion (#106)#110julianlucks wants to merge 3 commits into
julianlucks wants to merge 3 commits into
Conversation
…pen-webui#106) When Open WebUI rejects a file during ingestion (4xx, e.g. duplicate or empty content), it is never linked to the KB, so every subsequent sync/diff reports it as 'added' and oikb re-uploads it on every cycle. Each upload creates a new file record + physical copy server-side, which accumulates unboundedly (orphaned records, disk exhaustion). Record 4xx upload failures in the state DB (failed_file table, keyed by kb_id/path/filename with the checksum) and skip matching manifest entries on subsequent syncs until the source checksum changes. Auth failures (401/403) are deliberately not recorded so config problems keep surfacing. Successful uploads clear the record. New 'oikb failures' command lists/clears the records (--clear re-enables retries).
…-webui#106) Uploads return HTTP 200 while ingestion runs in the background; Open WebUI swallows processing errors (file status 'failed', or never linked to the KB). Every such file reappears as 'added' in each sync/diff and was re-uploaded on every cycle — creating a new server-side file record and physical copy each time. Record accepted uploads (checksum + server file id) in the state DB. On subsequent syncs, files the diff reports again are status-checked via GET /files/{id}/process/status instead of re-uploaded: - failed → recorded as permanent failure, skipped - completed, unlinked → re-link the existing file (covers duplicate content rejections and manual KB removals) - pending/processing → skipped this run, checked again next run - gone (404) → untracked, re-uploaded normally Tracked files no longer reported by the diff are untracked again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #106.
When Open WebUI rejects a file during ingestion, it is never linked to the KB, so
/sync/diffreports it as "added" on every subsequent sync and oikb re-uploads it on every cycle. Every upload creates a new file record and physical copy server-side, which accumulates unboundedly (orphaned records, disk growth).There are two rejection channels, both handled:
failed, or processed but never linked). Accepted uploads are now tracked (checksum + file id). When the diff reports a tracked file again, oikb checksGET /files/{id}/process/statusinstead of re-uploading:failed→ recorded as permanent failure, skippedcompletedbut unlinked → the existing file is re-linked in place (no second copy)pending/processing→ skipped for that run, checked again next runNotes:
oikb failurescommand (--kb-id,--clear,--json) to inspect/reset recorded rejections.skipped_failed/skipped_pendingcounters (CLI summary + daemon dry-run response).Test plan
failed, pending→linked, completed-unlinked→re-link, re-link rejected→permanent)