diff --git a/pipeline_bidding/bid_common.py b/pipeline_bidding/bid_common.py index d2cc18c..2ec4bee 100644 --- a/pipeline_bidding/bid_common.py +++ b/pipeline_bidding/bid_common.py @@ -371,7 +371,23 @@ async def create_human_task(sor, project_id, task_type, title, description="", 同一事项只发一次待办(2026-09-01 机制层不变量):同项目+同类型已有 pending 任务 → 直接返回已有 id,不重复创建。防止对账器/agent 每轮 重复发同类待办把用户淹没。 + + 项目状态门禁(2026-09-15,与引擎 create_human_task 同款):项目已删除或 + 处于 paused/archived/cancelled/completed → 不发新待办返回 ''(暂停/删除的 + 项目不再产生待办;恢复推进后对账器按需补发)。 """ + prec = await sor.sqlExe( + "SELECT status FROM sd_projects WHERE id=${p}$", {"p": project_id or ""}) + await sor.sqlExe("COMMIT", {}) + if not prec: + logger.info("bid create_human_task skipped: project %s deleted (type=%s)", + project_id, task_type) + return "" + _st = getattr(prec[0], "status", "") or "" + if _st in ("paused", "archived", "cancelled", "completed"): + logger.info("bid create_human_task skipped: project %s status=%s (type=%s)", + project_id, _st, task_type) + return "" exist = await find_human_task(sor, project_id, task_type, status="pending") if exist: logger.info("bid create_human_task dedup: type=%s existing=%s project=%s",