auto-sync: 2026-05-28 13:07:43
This commit is contained in:
@@ -555,6 +555,27 @@ class Dispatcher:
|
||||
logger.error("Mail %s: failed to mark working: %s", task_id, e)
|
||||
return False
|
||||
|
||||
def _mail_revert_to_pending(self, task_id: str, db_path: Path) -> None:
|
||||
"""Mail spawn 失败时回退 working → pending,避免永久死锁"""
|
||||
try:
|
||||
conn = get_connection(db_path)
|
||||
try:
|
||||
conn.execute("BEGIN IMMEDIATE")
|
||||
row = conn.execute("SELECT status FROM tasks WHERE id=?", (task_id,)).fetchone()
|
||||
if row and row["status"] == "working":
|
||||
conn.execute(
|
||||
"UPDATE tasks SET status='pending', updated_at=datetime('now') WHERE id=?",
|
||||
(task_id,),
|
||||
)
|
||||
conn.commit()
|
||||
logger.info("Mail %s: reverted working → pending (spawn failed)", task_id)
|
||||
else:
|
||||
logger.debug("Mail %s: skip revert (status=%s)", task_id, row["status"] if row else "?")
|
||||
finally:
|
||||
conn.close()
|
||||
except Exception as e:
|
||||
logger.error("Mail %s: failed to revert to pending: %s", task_id, e)
|
||||
|
||||
def _mail_auto_complete(self, task_id: str, agent_id: str,
|
||||
db_path: Path, must_haves: str) -> None:
|
||||
"""Mail 任务:on_complete 后自动标 done/failed(含幻觉门控)"""
|
||||
|
||||
Reference in New Issue
Block a user