fix: preserve configured KB scope for accurate search notices - #3904
Open
cj2026-bit wants to merge 9 commits into
Open
fix: preserve configured KB scope for accurate search notices#3904cj2026-bit wants to merge 9 commits into
cj2026-bit wants to merge 9 commits into
Conversation
cj2026-bit
requested review from
Dallas98,
WMC001 and
jeffwu-1999
as code owners
September 9, 2026 12:45
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Keep internal index names and KDS IDs for retrieval while exposing configured knowledge-base display names in scope notices and metadata. Leave independent AIDP search unchanged and add regression coverage for both updated tools. Co-authored-by: Codex <noreply@openai.com> Generated-by: gpt-5-codex
Use the effective configured scope when every requested knowledge base is invalid, matching omitted-scope behavior. Reuse mapping normalization helpers and update the affected tests. Co-authored-by: Codex <noreply@openai.com> Generated-by: gpt-5-codex
Rely on the existing early return for empty search scopes before entering the ES search flow. Co-authored-by: Codex <noreply@openai.com> Generated-by: gpt-5-codex
Treat explicit empty scopes as no-search requests, preserve fallback for invalid non-empty scopes, and report unavailable scopes without claiming a search ran. Co-authored-by: Codex <noreply@openai.com> Generated-by: gpt-5-codex
Co-authored-by: GPT-5 <noreply@openai.com>
…e-notice # Conflicts: # backend/agents/create_agent_info.py
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.
本次 PR 解决了什么 Bug
当一次知识库检索同时请求多个知识库时,后端会在生成运行时工具配置前,把无权限知识库从完整配置范围中删除。SDK 最终只能收到剩余的可访问知识库,因此无法区分:
这会导致原本属于“无权限”的知识库被错误提示为
not configured or unavailable,误导用户和模型判断失败原因。解决方案
allowed_kds_set传递真实有权限范围。kds_name,确保按知识库名称调用时也能正确分类。验证测试
自动化测试
test_create_agent_info.py:229 passedHTTP 接口验证
使用 DEV 账号通过真实
/api/agent/run调用 AIDP Agent,请求test666、test123、AIDP API Guide、test888,返回 notice:验证截图
修正后的权限过滤提示:
全部无效知识库回退到已配置可用范围:
空
kds_list回退到 Agent 已配置范围: