Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(agent_adapter): handle missing session id in tool refresh

z2tng541e5137b6df
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
index 3c21cc0770..f9d2697cc3 100644
--- a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
+++ b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
@@ -4116,7 +4116,7 @@ class JiuWenSwarmDeepAdapter:
) -> None:
"""注册 cron 和 send_file 工具(与 mode 无关,每次请求刷新)。"""
# 定时工具:按当前 session 的 channel 注册(contextvar 已由 _bind_runtime_cron_context 设置)
- if not (session_id.startswith("heartbeat") or session_id.startswith("cron")):
+ if session_id is None or not session_id.startswith(("heartbeat", "cron")):
try:
cron_tools = self._build_cron_tools()
if cron_tools: