Match the kb folder as a path component in _load_path#2165
Conversation
42b7dcf to
c1b1976
Compare
_load_path classified any config file or folder whose relative path starts with the letters "kb" as a knowledge-base document. A file named e.g. kbsettings.yml, or a subfolder like kbase/, was therefore treated as an (empty) kb doc and silently dropped -- its YAML config and any .co flows never loaded. Match the kb folder as a path component (kb + os.sep) so only files actually inside kb/ are collected as docs. Signed-off-by: winklemad <winklemad@outlook.com>
c1b1976 to
42f5645
Compare
|
@winklemad, this PR is being closed because it was opened before completing the required contribution workflow. Every PR must link to a triaged issue assigned to the PR author; this PR does not link to such an issue. The PR description must also use our current template, including the Related Issue, Verification, and AI Assistance sections. If AI tools substantially assisted with the contribution, disclose the tool and extent of assistance. The human contributor must review, verify, understand, and take responsibility for every submitted change. If no AI tools were used, select that option in the template. Before submitting another PR:
Please do not reopen this PR. You’re welcome to submit a new one after completing the workflow. See CONTRIBUTING.md and AI_POLICY.md. |
Description
_load_pathcollects knowledge-base documents by checkingrel_path.startswith("kb"). That matches on the name prefix, not thekb/folder, so any config file or folder whose name merely starts with "kb" is misclassified as a (usually empty) knowledge-base doc and silently dropped:kbsettings.ymlat the config root → treated as a doc; since it isn't.md, its YAML is never parsed and the config is lost.kbase/→ its.ymlconfig and any.coflows are dropped (the.cois never appended tocolang_files).Meanwhile a genuine
kb/doc.mdloads fine. The code's own comment already states the intent — "a file in thekbfolder".Fix
Match the
kbfolder as a path component (kb+os.sep) rather than a name prefix, so only files actually insidekb/are collected as docs. Genuinekb/documents are unaffected.Test Plan
Added
test_load_path_kb_prefixed_names_are_not_droppedtotests/test_config_loading.py: atmp_pathconfig directory withkbsettings.yml, akbase/subfolder containing a.coflow, and a genuinekb/doc.md. It asserts the kb-prefixed config file is parsed, the kb-prefixed.cois registered incolang_files, and the realkb/doc is still collected. Fails ondevelop, passes with the fix.No linked issue — found by reading the code.