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 <noreply@anthropic.com>
This commit is contained in:
@@ -88,8 +88,15 @@ public sealed class TaskMergeService
|
|||||||
List<string> files;
|
List<string> files;
|
||||||
try { files = await _git.ListConflictedFilesAsync(list.WorkingDir, ct); }
|
try { files = await _git.ListConflictedFilesAsync(list.WorkingDir, ct); }
|
||||||
catch { files = new(); }
|
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); }
|
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)
|
if (files.Count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user