fix(flow): 修复 finish 阶段分支合并的多个问题

1. 在 BranchManager 添加 _cleanup_lock_file 方法,清理 lock 文件
2. 将分支合并移到 git 提交之后执行
3. 在分支合并前再次提交状态文件(解决 save_status 更新 hash 后未提交的问题)

测试任务:创建 test-cache/hello.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-17 05:42:24 +08:00
parent be25738437
commit 5c236672c5
6 changed files with 115 additions and 10 deletions

View File

@@ -108,14 +108,6 @@ class FlowTracker:
if action == "next-part":
assert to_phase is not None
validator.validate_next_part(current_phase, to_phase)
# 如果进入 finish 环节,执行分支合并
if to_phase == "finish":
success, merge_msg = self.branch_mgr.finish_branch_merge(
task_summary=normalized_text,
)
if not success:
output.warn(merge_msg)
elif action == "back-part":
assert to_phase is not None
validator.validate_back_part(current_phase, to_phase)
@@ -135,6 +127,18 @@ class FlowTracker:
final_status = self._do_git_commit(updated, commit_msg)
self.storage.save_status(final_status)
# 如果进入 finish 环节,执行分支合并(必须在提交后执行)
if action == "next-part" and to_phase == "finish":
# 再次提交状态文件(因为 save_status 更新了 git_commit hash
self.git.add_all()
self.git.commit("[aide] finish: 更新状态文件")
success, merge_msg = self.branch_mgr.finish_branch_merge(
task_summary=normalized_text,
)
if not success:
output.warn(merge_msg)
if action == "next-part":
output.ok(f"进入环节: {to_phase}")
elif action == "back-part":