auto-sync: 2026-05-30 21:03:04
This commit is contained in:
@@ -670,7 +670,12 @@ class Dispatcher:
|
||||
# ══════════════════════════════════════════════
|
||||
|
||||
def _task_auto_complete(self, task_id: str, db_path) -> None:
|
||||
"""Task on_complete 后自动标 review/failed(三层幻觉门控第一层)"""
|
||||
"""Task on_complete 后自动标 review/done/failed(三层幻觉门控第一层)
|
||||
|
||||
设计意图:
|
||||
- 子任务(有 parent_task):working → review,等 parent review
|
||||
- 顶层任务(无 parent_task):working → done,直接完成
|
||||
"""
|
||||
from pathlib import Path
|
||||
if not db_path:
|
||||
logger.warning("Task %s: no db_path, skip auto_complete", task_id)
|
||||
@@ -679,8 +684,24 @@ class Dispatcher:
|
||||
try:
|
||||
passed = self._task_verify_completion(task_id, db_path)
|
||||
if passed:
|
||||
logger.info("Task %s: verify passed, marking review", task_id)
|
||||
self._mark_task_status(db_path, task_id, "review")
|
||||
# 判断是否是顶层任务
|
||||
is_top_level = True
|
||||
try:
|
||||
conn = get_connection(db_path)
|
||||
try:
|
||||
row = conn.execute("SELECT parent_task FROM tasks WHERE id=?", (task_id,)).fetchone()
|
||||
is_top_level = not (row and row["parent_task"])
|
||||
finally:
|
||||
conn.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if is_top_level:
|
||||
logger.info("Task %s: top-level task verify passed, marking done", task_id)
|
||||
self._mark_task_status(db_path, task_id, "done")
|
||||
else:
|
||||
logger.info("Task %s: sub-task verify passed, marking review", task_id)
|
||||
self._mark_task_status(db_path, task_id, "review")
|
||||
else:
|
||||
logger.info("Task %s: verify not passed (no signal), leaving working", task_id)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user