feat(merge): 自动合并失败时建最高优先级补救任务来完成合并
decide 端 exec_review accept→merge 冲突失败时,不再只是报错留在闸: 自动建一个 P0 easy 补救任务(operations 写明分支/目标/冲突详情与解冲突步骤), 自治项目会自动领取去解决。幂等:补救任务 id 记到原任务 result.mergeTaskId, 已有未结束补救任务则复用不重复建;结束(done/cancelled)后允许新建。 - model/types: TaskResult 加 mergeTaskId 字段 - mappers/orchestrator: 同步透传/补 null - store.ensureMergeRemediationTask + store.test 覆盖(P0/easy/ready/operations/幂等/可重建) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+7
-1
@@ -240,7 +240,13 @@ export function buildServer(opts: ApiOptions): FastifyInstance {
|
||||
if (!project) throw new StoreError(`项目不存在: ${task.projectId}`);
|
||||
const { branch, worktree } = task.result;
|
||||
const mr = await mergeBranch(project.repoPath, branch, project.defaultBranch, task.id);
|
||||
if (!mr.ok) throw new StoreError(`合并失败:${mr.error}(任务保留在审核闸)`);
|
||||
if (!mr.ok) {
|
||||
// 自动合并失败(多为冲突)→ 建/复用最高优先级补救任务来完成合并,原任务留在审核闸
|
||||
const rem = store.ensureMergeRemediationTask(task.id, {
|
||||
branch, targetBranch: project.defaultBranch, conflictError: mr.error ?? '未知冲突',
|
||||
});
|
||||
throw new StoreError(`合并失败:${mr.error}(原任务保留在审核闸;已建最高优先级补救任务 ${rem.id}「${rem.title}」来完成合并)`);
|
||||
}
|
||||
|
||||
store.decide(id, 'accept', b.actor ?? 'user', b.reason ?? null);
|
||||
// 合并产物记录:复用 prUrl 字段写 merged:<mergeCommit>
|
||||
|
||||
Reference in New Issue
Block a user