auto-sync: 2026-06-07 09:55:20
This commit is contained in:
+15
-11
@@ -1453,19 +1453,23 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_
|
||||
finally:
|
||||
conn.close()
|
||||
# F2: conn 已关闭,Blackboard 内部自己 get_connection
|
||||
if status == "failed":
|
||||
reason = (detail or {}).get("reason", "unknown")
|
||||
try:
|
||||
from src.blackboard.operations import Blackboard
|
||||
bb = Blackboard(db_path)
|
||||
reason = (detail or {}).get("reason", "unknown")
|
||||
cid = bb.add_comment(task_id, "daemon",
|
||||
f"@pangtong-fujunshi 任务执行失败: {reason},请评估是否需要介入",
|
||||
comment_type="system")
|
||||
bb.record_mentions(cid, task_id, ["pangtong-fujunshi"])
|
||||
logger.info("Task %s: failure notified pangtong via comment+mention (reason=%s)", task_id, reason)
|
||||
from src.daemon.mail_notify import _is_mail_project, notify_mail_failed
|
||||
if _is_mail_project(db_path):
|
||||
# Mail 失败:通知发件人,不 @pangtong
|
||||
notify_mail_failed(db_path, task_id, reason, detail)
|
||||
else:
|
||||
# Task 失败:@pangtong(F2 原逻辑)
|
||||
from src.blackboard.operations import Blackboard
|
||||
bb = Blackboard(db_path)
|
||||
cid = bb.add_comment(task_id, "daemon",
|
||||
f"@pangtong-fujunshi 任务执行失败: {reason},请评估是否需要介入",
|
||||
comment_type="system")
|
||||
bb.record_mentions(cid, task_id, ["pangtong-fujunshi"])
|
||||
logger.info("Task %s: failure notified pangtong via comment+mention (reason=%s)", task_id, reason)
|
||||
except Exception as e:
|
||||
logger.warning("Task %s: failed to notify pangtong: %s", task_id, e)
|
||||
except Exception:
|
||||
logger.warning("Task %s: failed to notify: %s", task_id, e)
|
||||
logger.exception("Failed to mark task %s as %s", task_id, status)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user