diff --git a/src/ClaudeDo.Data/Repositories/TaskRepository.cs b/src/ClaudeDo.Data/Repositories/TaskRepository.cs index aeaf6f8..a5e1ba0 100644 --- a/src/ClaudeDo.Data/Repositories/TaskRepository.cs +++ b/src/ClaudeDo.Data/Repositories/TaskRepository.cs @@ -196,6 +196,7 @@ public sealed class TaskRepository string title, string? description, string? commitType, + string? createdBy = null, CancellationToken ct = default) { // AsNoTracking: SetPlanningStartedAsync mutates via ExecuteUpdate which @@ -204,9 +205,6 @@ public sealed class TaskRepository .FirstOrDefaultAsync(t => t.Id == parentId, ct); if (parent is null) throw new InvalidOperationException($"Parent task {parentId} not found."); - if (parent.PlanningPhase == PlanningPhase.None) - throw new InvalidOperationException( - $"Parent task {parentId} is not in a planning phase; cannot attach children."); var maxSort = await _context.Tasks .Where(t => t.ListId == parent.ListId) @@ -224,6 +222,7 @@ public sealed class TaskRepository CommitType = string.IsNullOrEmpty(commitType) ? parent.CommitType : commitType, ParentTaskId = parentId, SortOrder = (maxSort ?? -1) + 1, + CreatedBy = createdBy, }; _context.Tasks.Add(child); await _context.SaveChangesAsync(ct); diff --git a/src/ClaudeDo.Worker/Planning/PlanningMcpService.cs b/src/ClaudeDo.Worker/Planning/PlanningMcpService.cs index 6bf9ffb..7d57df8 100644 --- a/src/ClaudeDo.Worker/Planning/PlanningMcpService.cs +++ b/src/ClaudeDo.Worker/Planning/PlanningMcpService.cs @@ -45,7 +45,7 @@ public sealed class PlanningMcpService CancellationToken cancellationToken) { var ctx = _contextAccessor.Current; - var child = await _tasks.CreateChildAsync(ctx.ParentTaskId, title, description, commitType, cancellationToken); + var child = await _tasks.CreateChildAsync(ctx.ParentTaskId, title, description, commitType, createdBy: null, cancellationToken); await BroadcastTaskUpdatedAsync(child.Id, cancellationToken); await BroadcastTaskUpdatedAsync(ctx.ParentTaskId, cancellationToken); return new CreatedChildDto(child.Id, child.Status.ToString());