Conversation
…back _clean_and_rechunk_content() fell back to self.chunker.chunk(content) when cleaning was enabled but no cleaning_provider_id was given, or when the provider lookup failed. Both fallbacks dropped the chunk_size and chunk_overlap passed for this upload and used the shared chunker's defaults (500/100), so a request for 128/16 was stored as 500-character chunks and later upload_document(pre_chunked_text=...) could not correct it. The non-cleaning path already forwarded the parameters. Forward chunk_size and chunk_overlap on both fallback paths. Fixes AstrBotDevs#9999
sourcery-ai
Bot
dismissed
their stale review
September 9, 2026 20:37
Sourcery withdrew this approval because the latest commits introduced blocking findings.
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.
Motivation / 动机
Fixes #9999.
KBHelper._clean_and_rechunk_content()fell back toself.chunker.chunk(content)in two places: when cleaning is enabled but nocleaning_provider_idis given, and whenget_provider_by_idfails. Both fallbacks dropped thechunk_size/chunk_overlaprequested for this upload and used the shared chunker's defaults (500/100), so a request for 128/16 was stored as 500-character chunks. Sinceupload_document(pre_chunked_text=...)uses those chunks as they are, the later size parameters could not correct it. The normal (cleaning disabled) path already forwarded the parameters.Modifications / 改动点
self.chunker.chunk(content, chunk_size=chunk_size, chunk_overlap=chunk_overlap); the warning log for the missing provider id names the parameters that are used.tests/test_kb_clean_rechunk_fallback.py: with a recording chunker and a provider manager whose lookup raises, both fallback paths (and the cleaning-disabled path) receivechunk_size=128, chunk_overlap=16and produce chunks of at most 128 characters. The two fallback tests fail onmasterand pass with the fix.Verification / 验证
Checklist / 检查清单
Summary by Sourcery
Keep requested chunking parameters when falling back to ordinary chunking during knowledge-base content processing.
Bug Fixes:
Enhancements:
Tests: