fix: Prevent conflict resolution agent from destroying initiative branch
spawnConflictResolutionAgent was passing the initiative branch as branchName, causing SimpleGitWorktreeManager.create() to force-reset it to the target branch. Now spawns on a unique temp branch based off the initiative branch, with the agent using git update-ref to advance the initiative branch after resolving conflicts. Also fixes stale diff/commits cache after resolution.
This commit is contained in:
@@ -459,7 +459,10 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
|
||||
status: 'in_progress',
|
||||
});
|
||||
|
||||
// Spawn agent
|
||||
// Spawn agent on a unique temp branch based off the initiative branch.
|
||||
// Using initiative.branch directly as branchName would cause SimpleGitWorktreeManager.create()
|
||||
// to run `git branch -f <branch> <base>`, force-resetting the initiative branch.
|
||||
const tempBranch = `${initiative.branch}-conflict-${Date.now()}`;
|
||||
const prompt = buildConflictResolutionPrompt(initiative.branch, targetBranch, conflicts);
|
||||
return agentManager.spawn({
|
||||
name: `conflict-${Date.now()}`,
|
||||
@@ -468,8 +471,8 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
|
||||
mode: 'execute',
|
||||
provider: input.provider,
|
||||
initiativeId: input.initiativeId,
|
||||
baseBranch: targetBranch,
|
||||
branchName: initiative.branch,
|
||||
baseBranch: initiative.branch,
|
||||
branchName: tempBranch,
|
||||
});
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user