Merge task branch for: fix(worker): deleting the last non-terminal child leaves the parent stuck in WaitingForChildren
This commit is contained in:
@@ -417,9 +417,18 @@ public sealed class TaskStateService : ITaskStateService
|
||||
_logger.LogWarning(ex, "PlanningChain advance failed for {TaskId}", taskId);
|
||||
}
|
||||
|
||||
await TryAdvanceParentAsync(parentId);
|
||||
}
|
||||
|
||||
// Any parent (planning or improvement) sitting in WaitingForChildren surfaces for review
|
||||
// once every child is terminal (Done/Failed/Cancelled). A failed or cancelled child does
|
||||
// not wedge the parent — it is flagged on the result. Also called directly after a child
|
||||
// is deleted, since no terminal transition fires in that case.
|
||||
public async Task TryAdvanceParentAsync(string parentId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await TryAdvanceParentAsync(parentId);
|
||||
await AdvanceParentIfAllChildrenTerminalAsync(parentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -427,10 +436,7 @@ public sealed class TaskStateService : ITaskStateService
|
||||
}
|
||||
}
|
||||
|
||||
// Any parent (planning or improvement) sitting in WaitingForChildren surfaces for review
|
||||
// once every child is terminal (Done/Failed/Cancelled). A failed or cancelled child does
|
||||
// not wedge the parent — it is flagged on the result.
|
||||
private async Task TryAdvanceParentAsync(string parentId)
|
||||
private async Task AdvanceParentIfAllChildrenTerminalAsync(string parentId)
|
||||
{
|
||||
string? parentResult;
|
||||
List<TaskStatus> childStatuses;
|
||||
|
||||
Reference in New Issue
Block a user