From 78d03388c0c1494577f601b0ddbd695aea1b1456 Mon Sep 17 00:00:00 2001 From: zhaoxi Date: Fri, 5 Jun 2026 18:45:00 +0000 Subject: [PATCH] =?UTF-8?q?fix(toolset):=20=E7=A9=BA=20toolset=5Fids=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=A7=86=E4=B8=BA=E6=9C=AA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=9B=9E=E9=80=80=E5=88=B0=E8=BF=94=E5=9B=9E=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=B7=A5=E5=85=B7=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit system_node_config.tools 在 DB 中为 [],导致 regulatory_node 间歇性 无工具可用。将空列表等同于 None 处理,确保节点始终获得默认工具集。 Co-Authored-By: Claude Opus 4.7 --- Makefile | 4 ++++ kilostar/utils/mcp_helper.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8d2623f..6c08409 100644 --- a/Makefile +++ b/Makefile @@ -21,3 +21,7 @@ db-history: db-stamp-head: uv run alembic stamp head +test: + docker compose down + docker rmi kilostar-kilostar:latest + docker compose up -d --build diff --git a/kilostar/utils/mcp_helper.py b/kilostar/utils/mcp_helper.py index 26421f3..823f4a1 100644 --- a/kilostar/utils/mcp_helper.py +++ b/kilostar/utils/mcp_helper.py @@ -107,7 +107,7 @@ async def get_all_toolsets_for_scope( Args: scope: 调用方所属 scope。 - toolset_ids: agent 配置的 toolset 列表;为 None 表示返回全部。 + toolset_ids: agent 配置的 toolset 列表;为 None 或空列表表示返回全部。 返回顺序保持稳定:先本地 toolset(按 toolset_ids),再 MCP toolset。 任意一类拉取失败仅记录日志,不影响其他类。 @@ -120,7 +120,8 @@ async def get_all_toolsets_for_scope( ) 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: toolsets.extend(local) except Exception as e: