refactor(worker): single parent-advance path for planning + improvement
Collapse TryCompleteParentAsync (planning -> Done) and TryAdvanceImprovementParentAsync (improvement -> WaitingForReview) into one TryAdvanceParentAsync that surfaces any WaitingForChildren parent for review once all children are terminal. Planning parents no longer auto-complete. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -386,28 +386,18 @@ public sealed class TaskStateService : ITaskStateService
|
||||
|
||||
try
|
||||
{
|
||||
await using var ctx = await _dbFactory.CreateDbContextAsync(CancellationToken.None);
|
||||
await new TaskRepository(ctx).TryCompleteParentAsync(parentId, CancellationToken.None);
|
||||
await TryAdvanceParentAsync(parentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "TryCompleteParent failed for {ParentId}", parentId);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await TryAdvanceImprovementParentAsync(parentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "TryAdvanceImprovementParent failed for {ParentId}", parentId);
|
||||
_logger.LogWarning(ex, "TryAdvanceParent failed for {ParentId}", parentId);
|
||||
}
|
||||
}
|
||||
|
||||
// Improvement parents sit in WaitingForChildren while their suggested children run.
|
||||
// Once every child is terminal (Done/Failed/Cancelled) the parent surfaces for review;
|
||||
// a failed or cancelled child does not wedge the parent — it is flagged on the result.
|
||||
private async Task TryAdvanceImprovementParentAsync(string 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.
|
||||
private async Task TryAdvanceParentAsync(string parentId)
|
||||
{
|
||||
string? parentResult;
|
||||
List<TaskStatus> childStatuses;
|
||||
|
||||
Reference in New Issue
Block a user