Eliminate duplicate wiki-tool implementations in skill/tools.py#79
Open
wutongyuonce wants to merge 1 commit into
Open
Eliminate duplicate wiki-tool implementations in skill/tools.py#79wutongyuonce wants to merge 1 commit into
skill/tools.py#79wutongyuonce wants to merge 1 commit into
Conversation
…skill to canonical agent tools
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.
Problem
openkb/skill/tools.pyclaims to "wrap the canonical wiki tools" fromopenkb/agent/tools.py, but two of its five functions were independentre-implementations rather than wrappers:
list_wiki_dirlist_wiki_filesread_wiki_file_for_skillread_wiki_fileget_skill_page_contentget_wiki_page_contentread_skill_imageread_wiki_imagewrite_skill_fileThis creates two risks:
forgotten in the other, creating a "two sources of truth" problem.
implementation to drift" while the code contradicts it.
Solution
Replace the bodies of
list_wiki_dirandread_wiki_file_for_skillwithsingle-line delegations to their canonical counterparts in
openkb/agent/tools.py, matching the pattern already established byget_skill_page_contentandread_skill_image.Changes
1 file changed:
openkb/skill/tools.pylist_wiki_files as _list_wiki_filesandread_wiki_file as _read_wiki_filefromopenkb.agent.tools.list_wiki_dir: body replaced withreturn _list_wiki_files(directory, wiki_root).read_wiki_file_for_skill: body replaced withreturn _read_wiki_file(path, wiki_root).functions are now delegated.
write_skill_file: unchanged (genuinely different security boundary).