auto-sync: 2026-05-29 13:40:18
This commit is contained in:
+9
-22
@@ -584,35 +584,18 @@ Project ID: {project_id}
|
||||
logger.exception("Failed to set parent %s to reviewing", parent_id)
|
||||
|
||||
def _handle_review_conclusion(self, parent_id: str, project_id: str,
|
||||
outcome: str, round_num: int):
|
||||
review_text: str, round_num: int):
|
||||
"""解析庞统 review 结论,更新 parent 状态
|
||||
|
||||
庞统完成后的回调。outcome 是 'completed'/'failed' 等状态字符串。
|
||||
需要从 DB 判断庞统做了什么:
|
||||
- 检查是否有新 sub task(比 round 开始前多)
|
||||
- 检查是否有 GOAL_ACHIEVED 标记
|
||||
review_text 是庞统回复的文本(从 spawner session meta payloads 拼接)。
|
||||
"""
|
||||
db_path = self._resolve_db_path(project_id)
|
||||
conn = get_connection(db_path)
|
||||
try:
|
||||
# 检查庞统是否创建了新 sub task
|
||||
sub_count = conn.execute(
|
||||
"SELECT COUNT(*) FROM tasks WHERE parent_task=?",
|
||||
(parent_id,)
|
||||
).fetchone()[0]
|
||||
# 解析 GOAL_ACHIEVED
|
||||
is_achieved = bool(review_text and "GOAL_ACHIEVED" in review_text.upper())
|
||||
|
||||
# 检查最新 comment 是否包含 GOAL_ACHIEVED
|
||||
goal_achieved = False
|
||||
latest_comment = conn.execute(
|
||||
"SELECT body FROM comments "
|
||||
"WHERE task_id=? AND author='pangtong-fujunshi' "
|
||||
"ORDER BY created_at DESC LIMIT 1",
|
||||
(parent_id,)
|
||||
).fetchone()
|
||||
if latest_comment and "GOAL_ACHIEVED" in (latest_comment["body"] or "").upper():
|
||||
goal_achieved = True
|
||||
|
||||
if goal_achieved:
|
||||
if is_achieved:
|
||||
# Goal 达成 → parent 最终完成
|
||||
conn.execute("BEGIN IMMEDIATE")
|
||||
conn.execute(
|
||||
@@ -631,6 +614,10 @@ Project ID: {project_id}
|
||||
"WHERE id=? AND status='reviewing'",
|
||||
(parent_id,))
|
||||
conn.commit()
|
||||
sub_count = conn.execute(
|
||||
"SELECT COUNT(*) FROM tasks WHERE parent_task=?",
|
||||
(parent_id,)
|
||||
).fetchone()[0]
|
||||
logger.info(
|
||||
"Parent %s review conclusion: continue → working "
|
||||
"(round %d, subs=%d)",
|
||||
|
||||
Reference in New Issue
Block a user