fix(worker): tighten ContinueMergeAsync guards and commit error handling

This commit is contained in:
mika kuns
2026-04-24 15:22:52 +02:00
parent 62106ff644
commit 63759ee7dc

View File

@@ -171,6 +171,7 @@ public sealed class TaskMergeService
}
if (wt is null) return Blocked("task has no worktree");
if (wt.State != WorktreeState.Active) return Blocked($"worktree state is {wt.State}");
if (string.IsNullOrWhiteSpace(list.WorkingDir)) return Blocked("list has no working directory");
if (!await _git.IsMidMergeAsync(list.WorkingDir, ct))
return Blocked("repo is not mid-merge");
@@ -181,7 +182,8 @@ public sealed class TaskMergeService
if (remaining.Count > 0)
return new MergeResult(StatusConflict, remaining, "conflicts not fully resolved");
await _git.CommitAsync(list.WorkingDir, $"Merge branch '{wt.BranchName}'", ct);
try { await _git.CommitAsync(list.WorkingDir, $"Merge branch '{wt.BranchName}'", ct); }
catch (Exception ex) { return Blocked($"commit failed: {ex.Message}"); }
using (var ctx = _dbFactory.CreateDbContext())
{