-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(knowledge-tools): scope kb_* tools to composer-selected bases too #16743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b7b091c
fix(knowledge-tools): scope kb_* tools to composer-selected bases too
eeee0717 ab1ca2a
Merge branch 'main' into slash-kb-not-triggering-tool
DeJeune ede850d
fix(ai-tools): scope knowledge-base tools to the effective request scope
eeee0717 adbc8b6
docs(ai-tools): sync remaining knowledgeBaseIds comments with the aut…
eeee0717 5f4bb0a
Merge branch 'main' into slash-kb-not-triggering-tool
eeee0717 e3951c7
Merge branch 'main' into slash-kb-not-triggering-tool
0xfullex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Blocker][A1] The
knowledgeBaseIdscalculated here is not passed intoresolveTools()/registry.selectActive(), but theappliesfor the fourkb_*tools have already been changed to checkscope.knowledgeBaseIds. The actual path is: composer passes inrequest.knowledgeBaseIds, here we get a non-empty scope, but line 80 still callsresolveTools(request, assistant, model, hasFileAttachments);resolveTools()line 190'sselectActive({ assistant, mcpToolIds, hasFileAttachments, hasAnyKnowledgeBase })doesn't includeknowledgeBaseIds, soKnowledgeSearchTooletc.'sappliesall return false. The result is that not only the composer-selected KB that this PR is supposed to fix won't expose tools, but the originally assistant statically-bound KB tools will also be hidden. Minimal fix: pass the effectiveknowledgeBaseIdsintoresolveTools, and pass it toregistry.selectActive({ ..., knowledgeBaseIds }); also add abuildAgentParamslevel test asserting that both assistant-bound and request-selected scenarios will selectkb_*tools.Original Content
[Blocker][A1] 这里算出的
knowledgeBaseIds没有进入resolveTools()/registry.selectActive(),但四个kb_*tool 的applies已经改成检查scope.knowledgeBaseIds。实际路径是:composer 传入request.knowledgeBaseIds,这里得到非空 scope,但第 80 行仍调用resolveTools(request, assistant, model, hasFileAttachments);resolveTools()第 190 行的selectActive({ assistant, mcpToolIds, hasFileAttachments, hasAnyKnowledgeBase })没带knowledgeBaseIds,所以KnowledgeSearchTool等的applies都返回 false。结果不仅本 PR 要修的 composer-selected KB 不会暴露工具,原本 assistant 静态绑定的 KB 工具也会被隐藏。最小修复:把 effectiveknowledgeBaseIds传进resolveTools,并传给registry.selectActive({ ..., knowledgeBaseIds });同时加一个buildAgentParams级别测试,断言 assistant-bound 和 request-selected 两种场景都会选中kb_*工具。