From d35800a10056eefb7da1d6059d641b6b0714550b Mon Sep 17 00:00:00 2001 From: p Date: Fri, 14 Aug 2026 11:36:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20git=20commit=20=E4=B8=8D=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=20files=5Fwritten=EF=BC=8C=E9=81=8D=E5=8E=86=20repos/?= =?UTF-8?q?=20=E4=B8=8B=E6=89=80=E6=9C=89=E4=BB=93=E5=BA=93=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/agent_loop.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 2a84f31..39faa9a 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -761,14 +761,16 @@ async def role_agent_run(project_id, role, agent_id=None, model_name=None): "created_by": agent_id or role, }) - # Git commit + push + # Git commit + push(遍历 repos/ 下所有仓库,不依赖 files_written——agent 可能直接用 write_file 写代码而不走 deliver.files) commit_msg = deliverable.get("git_commit_message") or f"{role}: {title[:80]}" - git_result = {"rc": 0, "message": "无git操作"} - if files_written: - for repo_name in os.listdir(repos_dir): - repo_path = os.path.join(repos_dir, repo_name) - if os.path.isdir(os.path.join(repo_path, '.git')): - git_result = await _git_commit_push(repo_path, commit_msg) + git_results = [] + for repo_name in sorted(os.listdir(repos_dir)): + repo_path = os.path.join(repos_dir, repo_name) + if os.path.isdir(os.path.join(repo_path, '.git')): + r = await _git_commit_push(repo_path, commit_msg) + git_results.append(f"{repo_name}: {r.get('message', '')}") + logger.info(f"git_commit_push {repo_name}: rc={r.get('rc', -1)} {r.get('message', '')[:100]}") + git_result = {"rc": 0, "message": "; ".join(git_results) if git_results else "无仓库可提交"} await sor.sqlExe( "UPDATE pipeline_tasks SET state=${st}$, claimed_by=NULL WHERE id=${tid}$",