fix(toolset): 空 toolset_ids 列表视为未配置,回退到返回全部工具集

system_node_config.tools 在 DB 中为 [],导致 regulatory_node 间歇性
无工具可用。将空列表等同于 None 处理,确保节点始终获得默认工具集。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 18:45:00 +00:00
parent 6792ad5485
commit 78d03388c0
2 changed files with 7 additions and 2 deletions
+4
View File
@@ -21,3 +21,7 @@ db-history:
db-stamp-head: db-stamp-head:
uv run alembic stamp head uv run alembic stamp head
test:
docker compose down
docker rmi kilostar-kilostar:latest
docker compose up -d --build
+3 -2
View File
@@ -107,7 +107,7 @@ async def get_all_toolsets_for_scope(
Args: Args:
scope: 调用方所属 scope。 scope: 调用方所属 scope。
toolset_ids: agent 配置的 toolset 列表;为 None 表示返回全部。 toolset_ids: agent 配置的 toolset 列表;为 None 或空列表表示返回全部。
返回顺序保持稳定:先本地 toolset(按 toolset_ids),再 MCP toolset。 返回顺序保持稳定:先本地 toolset(按 toolset_ids),再 MCP toolset。
任意一类拉取失败仅记录日志,不影响其他类。 任意一类拉取失败仅记录日志,不影响其他类。
@@ -120,7 +120,8 @@ async def get_all_toolsets_for_scope(
) )
snapshot = await fetch_snapshot() snapshot = await fetch_snapshot()
local = build_toolsets_for_scope(snapshot, scope, toolset_ids=toolset_ids) effective_ids = toolset_ids if toolset_ids else None
local = build_toolsets_for_scope(snapshot, scope, toolset_ids=effective_ids)
if local: if local:
toolsets.extend(local) toolsets.extend(local)
except Exception as e: except Exception as e: