fix(worker,ui): route details-pane task delete through worker to advance blocked parents

Deleting a child from the details pane hard-deleted straight from the UI
process via TaskRepository, bypassing TaskStateService.TryAdvanceParentAsync
entirely. Deleting the last child of a WaitingForChildren parent that way
left it wedged forever. WorkerHub.DeleteTask now mirrors the MCP delete_task
tool (running-task guard, FK-friendly error, advance-parent call), and the
UI goes through it.

TryAdvanceParentAsync also short-circuited when zero children remained,
treating "no children left" as "nothing to evaluate" instead of "all done" -
removed the early return so an empty child list (vacuously) counts as all
terminal.
This commit is contained in:
mika kuns
2026-08-06 13:25:49 +02:00
parent 0d1e3b9a6f
commit 9e2a15e421
11 changed files with 324 additions and 12 deletions
@@ -57,6 +57,10 @@ public interface IWorkerClient : INotifyPropertyChanged
Task<PendingQuestionDto?> GetPendingQuestionAsync(string taskId);
Task ResetTaskAsync(string taskId);
Task CancelTaskAsync(string taskId);
/// <summary>Deletes a task via the worker (mirrors the MCP delete_task tool), so a deleted
/// child correctly advances a WaitingForChildren parent. Returns (false, message) instead of
/// throwing when the task has children or is running, preserving the FK-error UX.</summary>
Task<(bool Ok, string? Error)> DeleteTaskAsync(string taskId);
Task<List<AgentInfo>> GetAgentsAsync();
Task RefreshAgentsAsync();
Task<SeedResultDto?> RestoreDefaultAgentsAsync();
+13
View File
@@ -327,6 +327,19 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
await _hub.InvokeAsync("CancelTask", taskId);
}
public async Task<(bool Ok, string? Error)> DeleteTaskAsync(string taskId)
{
try
{
await _hub.InvokeAsync("DeleteTask", taskId, CancellationToken.None);
return (true, null);
}
catch (HubException ex)
{
return (false, ex.Message);
}
}
public async Task WakeQueueAsync()
{
await _hub.InvokeAsync("WakeQueue");