fix(merge): apply the verify gate to worktree-less approvals and report it everywhere

ApproveAndMergeAsync short-circuits to Done whenever a task has no active
worktree -- which is exactly how a list-handler task works, since it commits
straight into the list working dir. The verify command was skipped for the run
that lands the most on the target branch at once; the loaded command was even
discarded at the destructuring. It now runs under the same per-repo gate as the
merge path before the task may reach Done.

The two merge entry points that did not know verify_failed reported it as
"Unknown status: verify_failed" (merge modal, dropping the command output) and
as a generic Failed (worktrees batch, claiming the merge never happened).
This commit is contained in:
mika kuns
2026-08-06 10:20:53 +02:00
parent 730ecb1abc
commit 091aca521f
6 changed files with 75 additions and 4 deletions
@@ -110,6 +110,12 @@ public sealed partial class MergeModalViewModel : ViewModelBase
case "blocked":
ErrorMessage = Loc.T("vm.merge.blocked", result.ErrorMessage ?? "");
break;
case "verify_failed":
// The merge landed; only the Done transition was withheld. Deliberately not
// treated as success -- no auto-close, because the failure text is the whole
// point of the gate.
ErrorMessage = result.ErrorMessage ?? Loc.T("vm.merge.verifyFailed");
break;
default:
ErrorMessage = Loc.T("vm.merge.unknownStatus", result.Status);
break;
@@ -12,7 +12,7 @@ using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Ui.ViewModels.Modals;
public enum BatchMergeOutcome { None, Merging, Merged, Conflict, Blocked, Failed }
public enum BatchMergeOutcome { None, Merging, Merged, Conflict, Blocked, VerifyFailed, Failed }
public sealed partial class WorktreeOverviewRowViewModel : ViewModelBase
{
@@ -402,6 +402,14 @@ public sealed partial class WorktreesOverviewModalViewModel : ViewModelBase
case "blocked":
row.MergeOutcome = BatchMergeOutcome.Blocked;
break;
case "verify_failed":
// The merge landed (so the worktree really is merged), but the list's
// verify command failed and the task was kept out of Done. Reporting
// this as a plain Failed would claim the merge didn't happen.
row.MergeOutcome = BatchMergeOutcome.VerifyFailed;
row.State = WorktreeState.Merged;
row.IsChecked = false;
break;
default:
row.MergeOutcome = BatchMergeOutcome.Failed;
break;