|
@@ -21,7 +21,6 @@ Sub-Trace 是完全独立的 Trace,有自己的目录:
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
import json
|
|
import json
|
|
|
-import os
|
|
|
|
|
import logging
|
|
import logging
|
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
|
from typing import Dict, List, Optional, Any
|
|
from typing import Dict, List, Optional, Any
|
|
@@ -213,7 +212,13 @@ class FileSystemTraceStore:
|
|
|
reason_preview = goal.reason[:60] + "..." if len(goal.reason) > 60 else goal.reason
|
|
reason_preview = goal.reason[:60] + "..." if len(goal.reason) > 60 else goal.reason
|
|
|
print(f" 💡 {reason_preview}")
|
|
print(f" 💡 {reason_preview}")
|
|
|
|
|
|
|
|
- async def update_goal(self, trace_id: str, goal_id: str, **updates) -> None:
|
|
|
|
|
|
|
+ async def update_goal(
|
|
|
|
|
+ self,
|
|
|
|
|
+ trace_id: str,
|
|
|
|
|
+ goal_id: str,
|
|
|
|
|
+ cascade_completion: bool = True,
|
|
|
|
|
+ **updates,
|
|
|
|
|
+ ) -> None:
|
|
|
"""更新 Goal 字段"""
|
|
"""更新 Goal 字段"""
|
|
|
tree = await self.get_goal_tree(trace_id)
|
|
tree = await self.get_goal_tree(trace_id)
|
|
|
if not tree:
|
|
if not tree:
|
|
@@ -237,7 +242,7 @@ class FileSystemTraceStore:
|
|
|
# 如果状态变为 completed,检查是否需要级联完成父 Goal
|
|
# 如果状态变为 completed,检查是否需要级联完成父 Goal
|
|
|
affected_goals = [{"goal_id": goal_id, "updates": updates}]
|
|
affected_goals = [{"goal_id": goal_id, "updates": updates}]
|
|
|
|
|
|
|
|
- if updates.get("status") == "completed":
|
|
|
|
|
|
|
+ if cascade_completion and updates.get("status") == "completed":
|
|
|
# 检查级联完成:如果所有兄弟 Goal 都完成,父 Goal 也完成
|
|
# 检查级联完成:如果所有兄弟 Goal 都完成,父 Goal 也完成
|
|
|
cascade_completed = await self._check_cascade_completion(trace_id, goal)
|
|
cascade_completed = await self._check_cascade_completion(trace_id, goal)
|
|
|
affected_goals.extend(cascade_completed)
|
|
affected_goals.extend(cascade_completed)
|