Merge claudedo/72b309e176cb4a96945159fd8dd6ce92
This commit is contained in:
@@ -338,6 +338,11 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
|
||||
{
|
||||
return (false, ex.Message);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// Hub connection is not active (worker offline / not yet connected).
|
||||
return (false, "Worker is offline. Reconnect and try again.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task WakeQueueAsync()
|
||||
|
||||
@@ -355,6 +355,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
|
||||
ContinueCommand.NotifyCanExecuteChanged();
|
||||
SendRoadblockReplyCommand.NotifyCanExecuteChanged();
|
||||
CancelReviewCommand.NotifyCanExecuteChanged();
|
||||
DeleteTaskCommand.NotifyCanExecuteChanged();
|
||||
}
|
||||
};
|
||||
_worker.PropertyChanged += _workerPropertyChangedHandler;
|
||||
@@ -963,7 +964,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
|
||||
await repo.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
[RelayCommand(CanExecute = nameof(CanDeleteTask))]
|
||||
private async System.Threading.Tasks.Task DeleteTaskAsync()
|
||||
{
|
||||
if (Task == null) return;
|
||||
@@ -976,7 +977,20 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
|
||||
// Routed through the worker (mirrors the MCP delete_task tool) so a deleted child
|
||||
// correctly advances a WaitingForChildren parent — a direct-repo delete from here used
|
||||
// to bypass TaskStateService.TryAdvanceParentAsync and could wedge the parent forever.
|
||||
var (deleted, error) = await _worker.DeleteTaskAsync(row.Id);
|
||||
bool deleted;
|
||||
string? error;
|
||||
try
|
||||
{
|
||||
(deleted, error) = await _worker.DeleteTaskAsync(row.Id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Belt and braces: the connection can drop between the CanExecute check and
|
||||
// this call, so a stray throw here must surface, not vanish silently.
|
||||
if (ShowErrorAsync != null)
|
||||
await ShowErrorAsync(ex.Message);
|
||||
return;
|
||||
}
|
||||
if (!deleted)
|
||||
{
|
||||
if (ShowErrorAsync != null)
|
||||
@@ -988,6 +1002,8 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
|
||||
CloseDetail?.Invoke();
|
||||
}
|
||||
|
||||
private bool CanDeleteTask() => Task != null && _worker.IsConnected;
|
||||
|
||||
[RelayCommand]
|
||||
private async System.Threading.Tasks.Task CommitSubtaskEditAsync(SubtaskRowViewModel? row)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user