Revert "fix: 心跳超时从 20 分钟回收重跑改为 10 分钟强制结束标注超时失败"

This reverts commit feb88aca023fdf0859fa1f8dae589acbd14c771c.
This commit is contained in:
ymq 2026-08-18 10:59:51 +08:00
parent feb88aca02
commit 0b75f10731

View File

@ -585,13 +585,12 @@ def load_pipeline_service():
while True:
try:
async with poll_db.sqlorContext("pipeline") as sor:
# 心跳超时处理running 任务 updated_at 超 10 分钟未更新 = 进程崩溃/协程挂起(僵尸),
# 强制结束并标注超时失败不回收重跑。last_error 用中文「心跳超时」,
# 让 _classify_failure 判 fault不自动重跑failed_poller 报故障通知用户。
# 回收僵尸 running 任务:进程崩溃/协程挂起遗留(心跳超时未更新)。
# 阈值 20 分钟 > LLM 单轮最坏时长3 次 × 300s 重试 ≈ 15 分钟),避免误杀慢任务。
await sor.sqlExe(
"UPDATE pipeline_tasks SET state='failed', claimed_by=NULL, last_error='心跳超时(10分钟未更新),已强制结束', updated_at=NOW() "
"UPDATE pipeline_tasks SET state='submitted', claimed_by=NULL, updated_at=NOW() "
"WHERE state='running' AND pipeline_id='role_task' "
"AND updated_at < (NOW() - INTERVAL 10 MINUTE)", {})
"AND updated_at < (NOW() - INTERVAL 20 MINUTE)", {})
# 全局并发 agent 数限制max_concurrent_agentsappbase params 表,默认 3
# 以 DB state='running' 计数为准(权威),超出上限时本轮回合不再派发。