fix(knowledge): reject empty document extraction - #19177
Merged
eeee0717 merged 1 commit intoAug 28, 2026
Merged
Conversation
Signed-off-by: userInner <1239989762@qq.com>
eeee0717
approved these changes
Aug 22, 2026
| @@ -94,14 +97,15 @@ export function createIndexDocumentsJobHandler( | |||
| const documents = await readItemDocuments(ctx, readableItem) | |||
| const chunked = await chunkItemDocuments(base, documents, ctx.signal) | |||
| if (chunked.chunks.length === 0) { | |||
Contributor
There was a problem hiding this comment.
建议修复:Authoritative Knowledge workflow documentation still describes zero-chunk indexing as successful completion, contradicting the changed handler's failure behavior.
inv_9f9316ad75d110ea#c0
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.
What this PR does
Before this PR:
Knowledge items whose reader or chunker produced no indexable text were rebuilt with an empty material and marked as completed. Scanned or image-only PDFs therefore appeared ready even though their content and chunks were empty.
After this PR:
Indexing rejects zero-chunk extraction results before embedding or material replacement. The existing job settlement path records a clear failure reason, so the item is shown as failed and remains available for reindexing after OCR or document-processing settings are corrected.
Fixes #19095
Why we need it and why it was done in this way
The zero-chunk boundary is the first shared point at which every reader result has been normalized and proven unusable for both vector and lexical retrieval. Rejecting there prevents paid embedding calls and avoids replacing a material with an empty index while reusing the existing failed-status, tooltip, and reindex behavior.
The following tradeoffs were made:
An empty extraction is treated as a failed indexing attempt instead of a successful empty document. This makes the failure visible but requires users to correct the source or processing configuration before reindexing.
The following alternatives were considered:
Links to places where the discussion took place: #19095
Breaking changes
None.
If this PR introduces breaking changes, please describe the changes and the impact on users.
Special notes for your reviewer
Regression coverage includes readers returning no documents and whitespace-only documents. It also verifies that empty results never enter embedding or material replacement and that job settlement persists the actionable failure reason.
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
main/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note