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:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"next_number": 2,
|
"next_number": 3,
|
||||||
"branches": [
|
"branches": [
|
||||||
{
|
{
|
||||||
"number": 1,
|
"number": 1,
|
||||||
@@ -10,6 +10,16 @@
|
|||||||
"task_summary": "开始任务准备: 创建环境安装 Command",
|
"task_summary": "开始任务准备: 创建环境安装 Command",
|
||||||
"started_at": "2025-12-17T04:54:31+08:00",
|
"started_at": "2025-12-17T04:54:31+08:00",
|
||||||
"status": "active"
|
"status": "active"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 2,
|
||||||
|
"branch_name": "aide/002",
|
||||||
|
"source_branch": "master",
|
||||||
|
"start_commit": "be2573843758e916d4da0b4c11ed04eaa4143dde",
|
||||||
|
"task_id": "2025-12-17T05-33-04",
|
||||||
|
"task_summary": "测试任务:写一个 hello 程序",
|
||||||
|
"started_at": "2025-12-17T05:33:04+08:00",
|
||||||
|
"status": "active"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# Git 分支概况
|
# Git 分支概况
|
||||||
|
|
||||||
|
## aide/002
|
||||||
|
|
||||||
|
- **任务**: 测试任务:写一个 hello 程序
|
||||||
|
- **任务ID**: 2025-12-17T05-33-04
|
||||||
|
- **源分支**: master
|
||||||
|
- **起始提交**: be25738
|
||||||
|
- **状态**: active
|
||||||
|
- **时间**: 2025-12-17 05:33
|
||||||
|
|
||||||
## aide/001
|
## aide/001
|
||||||
|
|
||||||
- **任务**: 开始任务准备: 创建环境安装 Command
|
- **任务**: 开始任务准备: 创建环境安装 Command
|
||||||
|
|||||||
75
.aide/flow-status.json
Normal file
75
.aide/flow-status.json
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"task_id": "2025-12-17T05-33-04",
|
||||||
|
"current_phase": "finish",
|
||||||
|
"current_step": 8,
|
||||||
|
"started_at": "2025-12-17T05:33:04+08:00",
|
||||||
|
"history": [
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:33:04+08:00",
|
||||||
|
"action": "start",
|
||||||
|
"phase": "task-optimize",
|
||||||
|
"step": 1,
|
||||||
|
"summary": "测试任务:写一个 hello 程序",
|
||||||
|
"git_commit": "356002d3d0377c11d3de2e3f16afd377c094d28a"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:33:33+08:00",
|
||||||
|
"action": "next-part",
|
||||||
|
"phase": "flow-design",
|
||||||
|
"step": 2,
|
||||||
|
"summary": "简单任务,跳过任务优化",
|
||||||
|
"git_commit": "eb089ce02d848208f271cfa1d2c7cfe831c7c06f"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:33:58+08:00",
|
||||||
|
"action": "next-part",
|
||||||
|
"phase": "impl",
|
||||||
|
"step": 3,
|
||||||
|
"summary": "简单任务,跳过流程设计",
|
||||||
|
"git_commit": "06f51ed01f04ea6cbc55b7c839a7d44582961603"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:34:46+08:00",
|
||||||
|
"action": "next-step",
|
||||||
|
"phase": "impl",
|
||||||
|
"step": 4,
|
||||||
|
"summary": "创建 hello.py 程序",
|
||||||
|
"git_commit": "01ff16417784cb976d19ac81a43bc542bce6e61b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:35:00+08:00",
|
||||||
|
"action": "next-part",
|
||||||
|
"phase": "verify",
|
||||||
|
"step": 5,
|
||||||
|
"summary": "代码实现完成",
|
||||||
|
"git_commit": "e97781d75c2421ca6e8280bf57240b48e5599e0c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:35:37+08:00",
|
||||||
|
"action": "next-step",
|
||||||
|
"phase": "verify",
|
||||||
|
"step": 6,
|
||||||
|
"summary": "验证程序运行正常",
|
||||||
|
"git_commit": "bac4ce699628f581bc9ae5a3fa10ff32ccf38820"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:35:51+08:00",
|
||||||
|
"action": "next-part",
|
||||||
|
"phase": "docs",
|
||||||
|
"step": 7,
|
||||||
|
"summary": "验证完成",
|
||||||
|
"git_commit": "4ac3aa186f33caf69bfe788537d5c473ffa019bf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": "2025-12-17T05:38:37+08:00",
|
||||||
|
"action": "next-part",
|
||||||
|
"phase": "finish",
|
||||||
|
"step": 8,
|
||||||
|
"summary": "测试任务完成,修复验证",
|
||||||
|
"git_commit": "7f59a660b1eafa4153ade83ceffe8075131ca32d"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source_branch": "master",
|
||||||
|
"start_commit": "be2573843758e916d4da0b4c11ed04eaa4143dde",
|
||||||
|
"task_branch": "aide/002"
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
34429
|
|
||||||
@@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
## 2025-12-17
|
## 2025-12-17
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
**aide flow 分支切换问题修复**
|
||||||
|
- 修复 finish 阶段分支切换时 lock 文件冲突的问题
|
||||||
|
- 修复 finish 阶段状态文件未提交导致切换失败的问题
|
||||||
|
- 在 `BranchManager` 添加 `_cleanup_lock_file` 方法
|
||||||
|
- 调整 `FlowTracker` 中分支合并的执行顺序(先提交再合并)
|
||||||
|
|
||||||
### 新增功能
|
### 新增功能
|
||||||
|
|
||||||
**环境安装 Commands**
|
**环境安装 Commands**
|
||||||
|
|||||||
@@ -108,14 +108,6 @@ class FlowTracker:
|
|||||||
if action == "next-part":
|
if action == "next-part":
|
||||||
assert to_phase is not None
|
assert to_phase is not None
|
||||||
validator.validate_next_part(current_phase, to_phase)
|
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":
|
elif action == "back-part":
|
||||||
assert to_phase is not None
|
assert to_phase is not None
|
||||||
validator.validate_back_part(current_phase, to_phase)
|
validator.validate_back_part(current_phase, to_phase)
|
||||||
@@ -135,6 +127,18 @@ class FlowTracker:
|
|||||||
final_status = self._do_git_commit(updated, commit_msg)
|
final_status = self._do_git_commit(updated, commit_msg)
|
||||||
self.storage.save_status(final_status)
|
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":
|
if action == "next-part":
|
||||||
output.ok(f"进入环节: {to_phase}")
|
output.ok(f"进入环节: {to_phase}")
|
||||||
elif action == "back-part":
|
elif action == "back-part":
|
||||||
|
|||||||
Reference in New Issue
Block a user