Skip to content

Fix: pass the kb id to the wiki page insert-error warning - #18985

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
muhzuhaib:fix-wiki-persist-insert-error-log
Aug 28, 2026
Merged

Fix: pass the kb id to the wiki page insert-error warning#18985
JinHai-CN merged 1 commit into
infiniflow:mainfrom
muhzuhaib:fix-wiki-persist-insert-error-log

Conversation

@muhzuhaib

Copy link
Copy Markdown
Contributor

Summary

persist_wiki_pages logs a warning when the bulk page insert reports errors without raising. Its format string has two placeholders, %d and %s, but only one argument is passed:

if insert_errors:
    logging.warning(
        "wiki_persist: page insert returned %d error(s) for kb=%s",
        len(insert_errors),
    )

At runtime the logging module cannot format the record. It catches the TypeError, writes a Logging error traceback to stderr, and the warning line is never emitted. So the knowledge base whose rows were dropped is invisible in exactly the situation this line exists to report, and what an operator sees instead is a logging traceback with no kb id in it.

Reproduction, on stock Python:

>>> import logging
>>> logging.warning("wiki_persist: page insert returned %d error(s) for kb=%s", 3)
--- Logging error ---
Traceback (most recent call last):
  ...
TypeError: not enough arguments for format string
Message: 'wiki_persist: page insert returned %d error(s) for kb=%s'
Arguments: (3,)

The intended argument is unambiguous: kb_id_str is in scope, and every other logging call in persist_wiki_pages that carries kb=%s passes it, seven of them. This adds it, and the diff is one line.

The line has been on main since 8379165 (#17931, 6 Aug). Found by running ruff check --select PLE1205,PLE1206 over the tree; it is the only hit in 1236 Python files, so there is no wider cleanup hiding behind it. Re-running the check on the patched tree returns clean.

The warning that reports partial failures from the bulk page insert in persist_wiki_pages has two placeholders in its format string, %d and %s, but only one argument is supplied. At runtime the logging module cannot format the record, so it writes a "Logging error" traceback to stderr and the warning itself never reaches the log. The knowledge base whose rows were dropped is therefore invisible in exactly the case the line exists to report. Every other logging call in the same function that carries kb=%s passes kb_id_str, seven of them, and that is the value added here.
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🌈 python Pull requests that update Python code 🐞 bug Something isn't working, pull request that fix bug. labels Aug 28, 2026
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fc89a59-0089-48da-8af9-1ea9b5bd11bb

📥 Commits

Reviewing files that changed from the base of the PR and between 6611370 and 87bcebd.

📒 Files selected for processing (1)
  • rag/svr/task_executor_refactor/dataset_wiki_generator.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The page-insert warning in persist_wiki_pages now passes kb_id_str to populate its %s placeholder.

Changes

Wiki logging fix

Layer / File(s) Summary
Populate page-insert warning context
rag/svr/task_executor_refactor/dataset_wiki_generator.py
The warning logger now receives kb_id_str as its format argument.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 87bce

This change makes the existing knowledge-base page-insert warning include the knowledge-base ID and emit correctly; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: buua436, kevinhush, harsh23kashyap

Poem

A rabbit watched the warning glow

“Now the knowledge ID will show.”
One argument joined the line,
The placeholder fits just fine.
The wiki hops along in time.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: passing the knowledge base ID to the wiki page insert-error warning.
Description check ✅ Passed The description includes the required Summary section and clearly explains the defect, runtime impact, intended fix, reproduction, and validation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN JinHai-CN self-assigned this Aug 28, 2026
@JinHai-CN JinHai-CN added the ci Continue Integration label Aug 28, 2026
@JinHai-CN JinHai-CN removed their assignment Aug 28, 2026
@JinHai-CN
JinHai-CN merged commit 7032877 into infiniflow:main Aug 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 🌈 python Pull requests that update Python code size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants