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:
Lukas May
2026-03-06 20:37:29 +01:00
parent a41caa633b
commit d4a28713f6
7 changed files with 103 additions and 28 deletions

View File

@@ -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)');
}
}
}
}