From 6511d6e0ff139495413c7848a9b4aabb9d9ee4e2 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 4 Mar 2026 21:25:34 +0000 Subject: Add READY state for human-in-the-loop verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Top-level tasks now land in READY after successful execution instead of going directly to COMPLETED. Subtasks (with parent_task_id) skip the gate and remain COMPLETED. Users accept or reject via new API endpoints: POST /api/tasks/{id}/accept → READY → COMPLETED POST /api/tasks/{id}/reject → READY → PENDING (with rejection_comment) - task: add StateReady, RejectionComment field, update ValidTransition - storage: migrate rejection_comment column, add RejectTask method - executor: route top-level vs subtask to READY vs COMPLETED - api: /accept and /reject handlers with 409 on invalid state Co-Authored-By: Claude Sonnet 4.6 --- internal/executor/executor.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'internal/executor/executor.go') diff --git a/internal/executor/executor.go b/internal/executor/executor.go index 68ebdf3..d25d3b4 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -149,8 +149,13 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) { p.store.UpdateTaskState(t.ID, task.StateFailed) } } else { - exec.Status = "COMPLETED" - p.store.UpdateTaskState(t.ID, task.StateCompleted) + if t.ParentTaskID == "" { + exec.Status = "READY" + p.store.UpdateTaskState(t.ID, task.StateReady) + } else { + exec.Status = "COMPLETED" + p.store.UpdateTaskState(t.ID, task.StateCompleted) + } } if updateErr := p.store.UpdateExecution(exec); updateErr != nil { -- cgit v1.2.3