From 3b1718783a5d730670a9bf20a0da3f98d56363b3 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 8 Aug 2026 13:51:52 +0800 Subject: [PATCH] fix: COMMIT after claim_task to release row lock before LLM call --- pipeline_service/agent_loop.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 29b7921..3f98bd2 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -409,6 +409,12 @@ async def role_agent_run(project_id, role, agent_id=None, model_name=None): params_str = getattr(task, "params", "{}") or "{}" workspace_dir = await _get_workspace_dir(sor, project_id) + # 提交 claim 事务,释放行锁 + try: + await sor.sqlExe("COMMIT", {}) + except Exception: + pass + # 确保 repos 目录存在 repos_dir = os.path.join(workspace_dir, 'repos') if not os.path.isdir(repos_dir): @@ -530,6 +536,12 @@ async def pm_review_run(project_id, agent_id=None, model_name=None): task_role = _normalize_role(getattr(task, "role", "") or "") workspace_dir = await _get_workspace_dir(sor, project_id) + # 提交 claim 事务,释放行锁,避免后续长操作(LLM调用)阻塞其他写入 + try: + await sor.sqlExe("COMMIT", {}) + except Exception: + pass + # 首次审核时,确保仓库已 clone repos = await _get_project_repos(sor, project_id) if repos: