From 1495c63e3df3b9a6bc742dba33ac4cb1d1352d50 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 22 Apr 2026 10:30:44 +0200 Subject: [PATCH] fix(worker): return Blocked when MergeAbortAsync fails to avoid stuck repo If git merge --abort throws, the repo is left mid-merge. Previously the code logged a warning and returned a conflict result, giving the UI a stale file list. Now it returns Blocked with an explicit message so the caller knows manual resolution is required. Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.Worker/Services/TaskMergeService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ClaudeDo.Worker/Services/TaskMergeService.cs b/src/ClaudeDo.Worker/Services/TaskMergeService.cs index df54264..3691345 100644 --- a/src/ClaudeDo.Worker/Services/TaskMergeService.cs +++ b/src/ClaudeDo.Worker/Services/TaskMergeService.cs @@ -88,8 +88,15 @@ public sealed class TaskMergeService List files; try { files = await _git.ListConflictedFilesAsync(list.WorkingDir, ct); } catch { files = new(); } + + // If abort fails the repo is left mid-merge; the caller must resolve manually. + // Return Blocked (not conflict) so the UI does not offer a stale conflict list. try { await _git.MergeAbortAsync(list.WorkingDir, ct); } - catch (Exception ex) { _logger.LogWarning(ex, "git merge --abort failed after conflict"); } + catch (Exception ex) + { + _logger.LogError(ex, "git merge --abort failed after conflict — repo is mid-merge"); + return Blocked($"merge conflict and abort failed: {ex.Message} — repo is mid-merge, resolve manually"); + } if (files.Count == 0) {