fix: conflict resolution tasks now get dispatched instead of permanently blocking initiative
- Remove original task blocking in handleConflict (task is already completed by handleAgentStopped) - Return created conflict task from handleConflict so orchestrator can queue it for dispatch - Add dedup check to prevent duplicate resolution tasks on crash retries - Queue conflict resolution task via dispatchManager in mergeTaskIntoPhase - Add recovery for erroneously blocked tasks in recoverDispatchQueues - Update tests and docs
This commit is contained in:
@@ -239,10 +239,14 @@ export class ExecutionOrchestrator {
|
||||
|
||||
if (!result.success && result.conflicts) {
|
||||
log.warn({ taskId, taskBranch, phaseBranch, conflicts: result.conflicts }, 'task merge conflict');
|
||||
await this.conflictResolutionService.handleConflict(taskId, result.conflicts, {
|
||||
const conflictTask = await this.conflictResolutionService.handleConflict(taskId, result.conflicts, {
|
||||
sourceBranch: taskBranch,
|
||||
targetBranch: phaseBranch,
|
||||
});
|
||||
if (conflictTask) {
|
||||
await this.dispatchManager.queue(conflictTask.id);
|
||||
log.info({ taskId: conflictTask.id, originalTaskId: taskId }, 'conflict resolution task queued for dispatch');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -615,6 +619,16 @@ export class ExecutionOrchestrator {
|
||||
tasksRecovered++;
|
||||
log.info({ taskId: task.id, agentId: agent?.id }, 'recovered stuck in_progress task (dead agent)');
|
||||
}
|
||||
} else if (task.status === 'blocked' && this.agentRepository) {
|
||||
// Task was blocked by merge conflict after agent had already completed.
|
||||
// If the agent finished successfully, mark the task completed so the
|
||||
// phase can progress.
|
||||
const agent = await this.agentRepository.findByTaskId(task.id);
|
||||
if (agent && (agent.status === 'idle' || agent.status === 'stopped')) {
|
||||
await this.taskRepository.update(task.id, { status: 'completed' });
|
||||
tasksRecovered++;
|
||||
log.info({ taskId: task.id, agentId: agent.id }, 'recovered blocked task (agent completed, merge conflict)');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user