fix: prevent phase stuck in_progress when merge fails
In YOLO mode, if mergePhaseIntoInitiative() threw (e.g., branch doesn't exist, merge conflict), the error propagated and completePhase() was never called — leaving the phase permanently stuck at in_progress. Also wrap per-phase recovery in try-catch so one failing phase doesn't abort the entire recoverDispatchQueues() loop.
This commit is contained in:
@@ -353,7 +353,11 @@ export class ExecutionOrchestrator {
|
||||
if (initiative.executionMode === 'yolo') {
|
||||
// Merge phase branch into initiative branch (only when branches exist)
|
||||
if (initiative.branch) {
|
||||
await this.mergePhaseIntoInitiative(phaseId);
|
||||
try {
|
||||
await this.mergePhaseIntoInitiative(phaseId);
|
||||
} catch (err) {
|
||||
log.error({ phaseId, err: err instanceof Error ? err.message : String(err) }, 'phase merge failed, completing phase anyway');
|
||||
}
|
||||
}
|
||||
await this.phaseDispatchManager.completePhase(phaseId);
|
||||
|
||||
@@ -663,6 +667,7 @@ export class ExecutionOrchestrator {
|
||||
const phases = await this.phaseRepository.findByInitiativeId(initiative.id);
|
||||
|
||||
for (const phase of phases) {
|
||||
try {
|
||||
// Re-queue approved phases into the phase dispatch queue
|
||||
if (phase.status === 'approved') {
|
||||
try {
|
||||
@@ -734,6 +739,9 @@ export class ExecutionOrchestrator {
|
||||
phasesRecovered++;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
log.error({ phaseId: phase.id, err: err instanceof Error ? err.message : String(err) }, 'phase recovery failed, continuing with remaining phases');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user