From bede609b9e5e46aa5257ce51af93ff63acd73708 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 16 Sep 2026 17:24:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(review/flow):=20=E7=AB=A0=E8=8A=82=E9=80=80?= =?UTF-8?q?=E5=9B=9E=E8=81=94=E5=8A=A8=E4=BD=9C=E5=BA=9F=E6=A0=87=E4=B9=A6?= =?UTF-8?q?(=E7=BD=AErejected=E9=87=8D=E6=B4=BE=E5=90=88=E6=88=90)+?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=97=A7=E4=BA=A4=E4=BB=98=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=BE=85=E5=8A=9E+G=E6=AE=B5cancelled=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E9=87=8D=E5=8F=91=E2=80=94=E2=80=94=E4=BF=AE=E7=94=98=E8=82=83?= =?UTF-8?q?=E5=AE=9E=E6=B5=8Bbug:=E7=AB=A0=E8=8A=82=E9=80=80=E5=9B=9E?= =?UTF-8?q?=E9=87=8D=E5=86=99=E5=90=8E=E6=96=87=E6=A1=A3=E5=81=9Cpassed,?= =?UTF-8?q?=E6=96=B0=E6=AD=A3=E6=96=87=E6=B0=B8=E8=BF=9C=E8=BF=9B=E4=B8=8D?= =?UTF-8?q?=E4=BA=86=E4=BA=A4=E4=BB=98=E7=89=A9,=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E5=83=B5=E5=B0=B8=E6=8C=87=E5=90=91=E6=97=A7=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_bidding/bid_flow.py | 4 +++- pipeline_bidding/bid_review_capability.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pipeline_bidding/bid_flow.py b/pipeline_bidding/bid_flow.py index 2a49ba7..3cf7477 100644 --- a/pipeline_bidding/bid_flow.py +++ b/pipeline_bidding/bid_flow.py @@ -1386,7 +1386,9 @@ async def reconcile_project(sor, project_id, project_name=""): await sor.sqlExe("COMMIT", {}) return acts + ["trimmed: delivery_confirm 已裁剪,标书直接置 delivered,项目完成"] ht = await find_human_task(sor, project_id, HT_DELIVERY_CONFIRM) - if not ht: + # cancelled/rejected 的旧待办视为不存在(2026-09-16:章节退回重写时联动作废 + # 过旧待办,重合成后必须重发新版确认待办,否则卡 waiting 死锁) + if not ht or ht.get("status") in ("cancelled", "rejected"): hid = await create_human_task( sor, project_id, HT_DELIVERY_CONFIRM, "标书评分通过,请确认交付", "标书已通过评分门限,请人工复核用印/密封/份数/递交后确认交付。") diff --git a/pipeline_bidding/bid_review_capability.py b/pipeline_bidding/bid_review_capability.py index a0cf47e..07e4cfe 100644 --- a/pipeline_bidding/bid_review_capability.py +++ b/pipeline_bidding/bid_review_capability.py @@ -163,6 +163,26 @@ async def review_chapter(chapter_id, score, max_score="", comments="", detail="" who=who, agent_id=agent_id, detail="%.2f/%.2f revise=%d" % (sc, ms, revise)) + # ── 标书状态联动作废(2026-09-16 甘肃项目实测 bug)── + # 章节退回重写时,若 bid_documents 已合成且停在 draft/reviewing/passed, + # 对账器 E 段只对「无文档 or 文档 rejected」派合成任务 → 重写后的新正文 + # 永远进不了交付物(甘肃 bid_v1 即此状:章节被退回、文档仍 passed、 + # 待办仍指向旧版)。退回即把当前标书置 rejected,全章 approved 后 + # 自动重派合成(prev_version 递增出新版),形成完整闭环。 + try: + await sor.sqlExe( + "UPDATE bid_documents SET status='rejected', updated_at=NOW() " + "WHERE project_id=${pid}$ AND status IN ('draft','reviewing','passed')", + {"pid": pid}) + # 交付确认待办同步取消(指向旧版标书,留着=僵尸待办误导用户确认旧版) + await sor.sqlExe( + "UPDATE pipeline_human_tasks SET status='cancelled', updated_at=NOW() " + "WHERE project_id=${pid}$ AND task_type=${tt}$ AND status='pending'", + {"pid": pid, "tt": "bid_delivery_confirm"}) + await sor.sqlExe("COMMIT", {}) + except Exception as e: # noqa: BLE001 + logger.warning("章节退回联动标书作废失败 pid=%s: %s", pid, e) + if revise > th["max_revise"]: # 2026-09-16 标题级去重:多章各自达上限各发一条(旧代码类型级 dedup, # 第 2~N 章升级信号被第一条 general pending 吞掉——甘肃项目 1/2.1.5/2.2