From feb88aca023fdf0859fa1f8dae589acbd14c771c Mon Sep 17 00:00:00 2001 From: ymq Date: Tue, 18 Aug 2026 10:53:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BF=83=E8=B7=B3=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E4=BB=8E=2020=20=E5=88=86=E9=92=9F=E5=9B=9E=E6=94=B6=E9=87=8D?= =?UTF-8?q?=E8=B7=91=E6=94=B9=E4=B8=BA=2010=20=E5=88=86=E9=92=9F=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E7=BB=93=E6=9D=9F=E6=A0=87=E6=B3=A8=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit running 任务 updated_at 超 10 分钟未更新(进程崩溃/协程挂起僵尸),原逻辑回收回 submitted 重跑,改为 state=failed + last_error=心跳超时。中文 last_error 让 _classify_failure 判 fault 不自动重跑,failed_poller 报故障通知用户。 --- pipeline_service/init.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pipeline_service/init.py b/pipeline_service/init.py index ca870bf..170b254 100644 --- a/pipeline_service/init.py +++ b/pipeline_service/init.py @@ -585,12 +585,13 @@ def load_pipeline_service(): while True: try: async with poll_db.sqlorContext("pipeline") as sor: - # 回收僵尸 running 任务:进程崩溃/协程挂起遗留(心跳超时未更新)。 - # 阈值 20 分钟 > LLM 单轮最坏时长(3 次 × 300s 重试 ≈ 15 分钟),避免误杀慢任务。 + # 心跳超时处理:running 任务 updated_at 超 10 分钟未更新 = 进程崩溃/协程挂起(僵尸), + # 强制结束并标注超时失败(不回收重跑)。last_error 用中文「心跳超时」, + # 让 _classify_failure 判 fault(不自动重跑),failed_poller 报故障通知用户。 await sor.sqlExe( - "UPDATE pipeline_tasks SET state='submitted', claimed_by=NULL, updated_at=NOW() " + "UPDATE pipeline_tasks SET state='failed', claimed_by=NULL, last_error='心跳超时(10分钟未更新),已强制结束', updated_at=NOW() " "WHERE state='running' AND pipeline_id='role_task' " - "AND updated_at < (NOW() - INTERVAL 20 MINUTE)", {}) + "AND updated_at < (NOW() - INTERVAL 10 MINUTE)", {}) # 全局并发 agent 数限制(max_concurrent_agents,appbase params 表,默认 3)。 # 以 DB state='running' 计数为准(权威),超出上限时本轮回合不再派发。