feat: Parent-Child TaskFlow — Delegated durch sichtbare Child-Tasks ersetzt

- Delegated State aus Board, Entities, DTOs, Frontend-Spalten und Tests entfernt
- Parent-Tasks bleiben InProgress waehrend delegierter Agentenarbeit
- Child-Tasks laufen sichtbar mit normalen States und parentTaskId
- Doku: README, Phase 3, Changelog, Controller-Kommentare angepasst
- openclaw-task-board-flow.md als Referenzdoku hinzugefuegt
- 73/73 Backend-Tests gruen, Frontend-Build gruen
This commit is contained in:
2026-06-21 21:30:52 +02:00
parent b89289989a
commit ac131f7f53
15 changed files with 464 additions and 133 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ public class TasksController(ITaskService taskService) : ControllerBase
=> Results.Ok(await taskService.GetBoardAsync(ct));
/// <summary>
/// Setzt stale Tasks (InProgress/Delegated, älter als N Stunden) zurück auf Backlog.
/// Setzt stale Tasks (InProgress, älter als N Stunden) zurück auf Backlog.
/// Wird vom Iris Autonomous Worker genutzt.
/// </summary>
[AllowAnonymous]
+3 -9
View File
@@ -18,7 +18,6 @@ public enum TaskState
{
Backlog,
InProgress,
Delegated,
Blocked,
Done,
Review
@@ -30,7 +29,6 @@ public static class TaskStateHelper
{
[TaskState.Backlog] = "Backlog",
[TaskState.InProgress] = "In progress",
[TaskState.Delegated] = "Delegated",
[TaskState.Blocked] = "Blocked",
[TaskState.Done] = "Done",
[TaskState.Review] = "Review"
@@ -40,7 +38,6 @@ public static class TaskStateHelper
{
["Backlog"] = TaskState.Backlog,
["In progress"] = TaskState.InProgress,
["Delegated"] = TaskState.Delegated,
["Blocked"] = TaskState.Blocked,
["Done"] = TaskState.Done,
["Review"] = TaskState.Review
@@ -51,14 +48,13 @@ public static class TaskStateHelper
{
["Backlog"] = "Offen",
["In progress"] = "In Bearbeitung",
["Delegated"] = "Delegiert",
["Review"] = "Review",
["Blocked"] = "Blockiert",
["Done"] = "Erledigt"
};
/// <summary>Valid task-state string values for API validation.</summary>
public static readonly string[] AllStates = ["Backlog", "In progress", "Delegated", "Blocked", "Done", "Review"];
public static readonly string[] AllStates = ["Backlog", "In progress", "Blocked", "Done", "Review"];
/// <summary>Convert a TaskState enum to its API string representation.</summary>
public static string ToStateString(this TaskState state) => StateToString[state];
@@ -87,7 +83,7 @@ public static class TaskStateHelper
/// Returns true if the caller is allowed to change this task's state.
/// POLICY:
/// - **Iris und Bao** dürfen Status ändern / verschieben.
/// - Sub-agents (programmer, reviewer, architekt) dürfen NIEMALS Status ändern.
/// - Sub-agents (programmer, reviewer, architekt, researcher, executor) dürfen NIEMALS Status ändern.
/// - 'nexus-system' ist ein technischer Fallback für automatische Cron/Reset-Workflows.
/// - Jeder andere (unbekannt, leer) wird abgewiesen.
/// </summary>
@@ -96,7 +92,7 @@ public static class TaskStateHelper
var caller = callerAgent?.Trim().ToLowerInvariant() ?? "";
// Sub-agents must never move state
var subAgents = new HashSet<string> { "programmer", "reviewer", "architekt" };
var subAgents = new HashSet<string> { "programmer", "reviewer", "architekt", "researcher", "executor" };
if (subAgents.Contains(caller)) return false;
// Technischer Fallback: nur für interne System-Operationen (Cron, ResetStale)
@@ -129,7 +125,6 @@ public static class TaskStateHelper
{
"backlog" => "offen",
"in progress" => "inProgress",
"delegated" => "delegated",
"review" => "review",
"blocked" => "blocked",
"done" => "done",
@@ -146,7 +141,6 @@ public static class TaskStateHelper
{
"offen" => "Backlog",
"inprogress" => "In progress",
"delegated" => "Delegated",
"review" => "Review",
"blocked" => "Blocked",
"done" => "Done",
+1
View File
@@ -34,6 +34,7 @@ public class NexusUser
/// if the underlying data is deleted. This is the single guard that
/// prevents owner-password drift after DB resets or volume recreations.
/// </summary>
[Table("SeedAudit")]
public class SeedAudit
{
[Key]
-1
View File
@@ -138,7 +138,6 @@ public sealed record AgentActivityEntry(
public sealed record BoardResponse(
List<DashboardTaskDto> Offen,
List<DashboardTaskDto> InProgress,
List<DashboardTaskDto> Delegated,
List<DashboardTaskDto> Review,
List<DashboardTaskDto> Blocked,
List<DashboardTaskDto> Done
+14 -15
View File
@@ -161,8 +161,8 @@ public sealed class TaskService(
/// <summary>
/// Returns agent-tasks grouped by which agent is expected to respond,
/// with stale-detection: tasks in InProgress/Delegated that haven't been
/// updated within the stale threshold.
/// with stale-detection: parent tasks that remain in progress while child work
/// is active, and any in-progress task that has not been updated within the stale threshold.
/// </summary>
public async Task<AgentWorkflowOverview> GetAgentWorkflowOverviewAsync(TimeSpan staleThreshold, CancellationToken ct = default)
{
@@ -194,8 +194,7 @@ public sealed class TaskService(
var staleTasks = map(agentTasks
.Where(t =>
(string.Equals(t.State, "In progress", StringComparison.OrdinalIgnoreCase) ||
string.Equals(t.State, "Delegated", StringComparison.OrdinalIgnoreCase)) &&
string.Equals(t.State, "In progress", StringComparison.OrdinalIgnoreCase) &&
t.UpdatedAt < threshold));
return new AgentWorkflowOverview(waitingForBao, waitingForIris, waitingForOthers,
@@ -214,14 +213,18 @@ public sealed class TaskService(
throw new ArgumentException($"Parent task {parentTaskId} not found.", nameof(parentTaskId));
}
var normalizedSource = string.IsNullOrWhiteSpace(source) ? "bao" : source.Trim().ToLowerInvariant();
var normalizedAssignee = ValidateAssignedTo(assignedTo);
var task = new WorkTask
{
Title = title.Trim(),
Detail = detail?.Trim(),
Source = string.IsNullOrWhiteSpace(source) ? "bao" : source.Trim(),
Source = normalizedSource,
Priority = string.IsNullOrWhiteSpace(priority) ? "Normal" : priority.Trim(),
AssignedTo = ValidateAssignedTo(assignedTo),
ParentTaskId = parentTaskId
AssignedTo = normalizedAssignee,
ParentTaskId = parentTaskId,
IsAgentTask = parentTaskId.HasValue
};
await taskRepo.AddAsync(task, ct);
@@ -231,7 +234,7 @@ public sealed class TaskService(
await activityRepo.AddAsync(new ActivityEvent { Type = "task", Message = message, TaskId = task.Id }, ct);
// Auto-notify: if assigned to bao, create a task_assigned notification
if (string.Equals(assignedTo, "bao", StringComparison.OrdinalIgnoreCase))
if (string.Equals(normalizedAssignee, "bao", StringComparison.OrdinalIgnoreCase))
{
await notificationService.CreateAsync(
"task_assigned",
@@ -253,6 +256,7 @@ public sealed class TaskService(
task.IsAgentTask = true;
task.ExpectedFrom = string.IsNullOrWhiteSpace(expectedFrom) ? null : expectedFrom.Trim().ToLowerInvariant();
task.State = TaskStateHelper.ToStateString(TaskState.InProgress);
// Persist the agent-task-specific fields
await taskRepo.UpdateAsync(task, ct);
@@ -407,7 +411,6 @@ public sealed class TaskService(
var all = await taskRepo.GetAllAsync(ct);
var offen = new List<DashboardTaskDto>();
var inProgress = new List<DashboardTaskDto>();
var delegated = new List<DashboardTaskDto>();
var review = new List<DashboardTaskDto>();
var blocked = new List<DashboardTaskDto>();
var done = new List<DashboardTaskDto>();
@@ -421,8 +424,6 @@ public sealed class TaskService(
offen.Add(dto); break;
case "in progress":
inProgress.Add(dto); break;
case "delegated":
delegated.Add(dto); break;
case "review":
review.Add(dto); break;
case "blocked":
@@ -436,12 +437,11 @@ public sealed class TaskService(
offen.Sort(SortByPriorityThenCreatedAt);
inProgress.Sort(SortByPriorityThenCreatedAt);
delegated.Sort(SortByPriorityThenCreatedAt);
review.Sort(SortByPriorityThenCreatedAt);
blocked.Sort(SortByPriorityThenCreatedAt);
done.Sort(SortByPriorityThenCreatedAt);
return new BoardResponse(offen, inProgress, delegated, review, blocked, done);
return new BoardResponse(offen, inProgress, review, blocked, done);
}
private static int SortByPriorityThenCreatedAt(DashboardTaskDto a, DashboardTaskDto b)
@@ -500,8 +500,7 @@ public sealed class TaskService(
var all = await taskRepo.GetAllAsync(ct);
var threshold = DateTimeOffset.UtcNow - staleThreshold;
var staleTasks = all.Where(t =>
(string.Equals(t.State, "In progress", StringComparison.OrdinalIgnoreCase) ||
string.Equals(t.State, "Delegated", StringComparison.OrdinalIgnoreCase)) &&
string.Equals(t.State, "In progress", StringComparison.OrdinalIgnoreCase) &&
t.UpdatedAt < threshold).ToList();
foreach (var task in staleTasks)