From 099c2835623e3a016ca6751a17d163a33ed2d9f4 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 02:04:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20PM=E5=AE=A1=E6=A0=B8=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=8A=A0auto-inject=E5=85=9C=E5=BA=95=EF=BC=8C=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=A4=E8=BD=AE=E5=BC=BA=E5=88=B6review=5F*?= =?UTF-8?q?=E5=86=B3=E7=AD=96=EF=BC=8C=E9=98=B2=E5=AE=A1=E6=A0=B8=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E6=AD=BB=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/agent_loop.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index aef088d..86f5bfb 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -840,6 +840,13 @@ async def pm_review_run(project_id, agent_id=None, model_name=None): "UPDATE pipeline_tasks SET updated_at=NOW() WHERE id=${tid}$ AND state='review'", {"tid": task_id}) await sor.sqlExe("COMMIT", {}) + # auto-inject 兜底:最后两轮强制要求给出 review_* 决策,禁止再 tool_call, + # 否则 deepseek 会一直读文件/git_status 耗尽 5 轮 → 审核超时 → 打回重跑 → 死循环 + if turn >= 3: + msgs.append({"role": "user", "content": + "已检查足够信息。现在必须立即输出最终决策 JSON," + "只能是 review_approve / review_reject / review_complete 三者之一," + "禁止再调用任何工具。"}) try: raw = await llm_call_msgs(msgs, model=model_name, temperature=0.3) except Exception as e: