|
|
@@ -890,7 +890,7 @@ class AgentRunner:
|
|
|
tc.get("function", {}).get("name") == "goal"
|
|
|
for tc in tool_calls
|
|
|
)
|
|
|
- logger.debug(f"[Auto Root Goal] goal_tree.goals={len(goal_tree.goals)}, has_goal_call={has_goal_call}, tool_calls={[tc.get('function', {}).get('name') for tc in tool_calls]}")
|
|
|
+ logger.debug(f"[Auto Root Goal] Before tool execution: goal_tree.goals={len(goal_tree.goals)}, has_goal_call={has_goal_call}, tool_calls={[tc.get('function', {}).get('name') for tc in tool_calls]}")
|
|
|
if not has_goal_call:
|
|
|
mission = goal_tree.mission
|
|
|
root_desc = mission[:200] if len(mission) > 200 else mission
|
|
|
@@ -992,7 +992,8 @@ class AgentRunner:
|
|
|
merged_tags = {**config.knowledge.default_tags, **existing_tags}
|
|
|
tool_args["tags"] = merged_tags
|
|
|
if config.knowledge.default_scopes:
|
|
|
- tool_args.setdefault("scopes", config.knowledge.default_scopes)
|
|
|
+ existing_scopes = tool_args.get("scopes") or []
|
|
|
+ tool_args["scopes"] = existing_scopes + config.knowledge.default_scopes
|
|
|
elif tool_name == "knowledge_search":
|
|
|
if config.knowledge.default_search_types and "types" not in tool_args:
|
|
|
tool_args["types"] = config.knowledge.default_search_types
|
|
|
@@ -1017,6 +1018,10 @@ class AgentRunner:
|
|
|
}
|
|
|
)
|
|
|
|
|
|
+ # 如果是 goal 工具,记录执行后的状态
|
|
|
+ if tool_name == "goal" and goal_tree:
|
|
|
+ logger.debug(f"[Goal Tool] After execution: goal_tree.goals={len(goal_tree.goals)}, current_id={goal_tree.current_id}")
|
|
|
+
|
|
|
# 跟踪保存的知识 ID
|
|
|
if tool_name == "knowledge_save" and isinstance(tool_result, dict):
|
|
|
metadata = tool_result.get("metadata", {})
|