refactor(workflow): stop assuming a human decides

An approval, ask or park can be resolved by an operator, a rule, a
classifier or automatically, so the vocabulary stops naming a person:

- step type human.approve -> workflow.approve
- park class needs_human -> needs_decision (ParkNeedsDecision)
- event kinds human_* -> operator_*
- alert kind task.needs_human -> task.needs_decision
- status grouping "needs you" -> "needs attention"

0061 rewrites the stored values, including the approval step type in the
workflow-definitions resource and each task's pinned definition, with the
digest recomputed so resumed tasks still match.
This commit is contained in:
sam committed 2026-10-25 17:31:16 +11:00
1 parent fc609171ca
commit f2b8681611
76 files changed
+373 -329

No files matched your search

@@ -141,7 +141,7 @@ func (q *Queries) ArchiveTaskDelete(ctx context.Context, arg ArchiveTaskDeletePa
}
const beginRemediationTask = `-- name: BeginRemediationTask :execrows
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_human', review_payload = $2, retry_mode = 'continue_pushed_work', resume_from = '', resume_results = '{}', updated_at = now()
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_decision', review_payload = $2, retry_mode = 'continue_pushed_work', resume_from = '', resume_results = '{}', updated_at = now()
WHERE id = $1 AND status = 'pr_open'
`
@@ -802,7 +802,7 @@ func (q *Queries) ParkTask(ctx context.Context, arg ParkTaskParams) (int64, erro
const promotePendingReview = `-- name: PromotePendingReview :execrows
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '',
park_class = 'needs_human',
park_class = 'needs_decision',
review_payload = pending_reviews->>0, pending_reviews = pending_reviews - 0,
retry_mode = 'continue_pushed_work', resume_from = '', resume_results = '{}',
updated_at = now()
@@ -836,7 +836,7 @@ func (q *Queries) RecoverStaleTasks(ctx context.Context) (int64, error) {
const requeueTask = `-- name: RequeueTask :execrows
UPDATE tasks SET status = 'queued',
workflow = CASE WHEN $1::text = '' THEN workflow ELSE $1::text END,
park_reason = '', park_class = 'needs_human', updated_at = now()
park_reason = '', park_class = 'needs_decision', updated_at = now()
WHERE id = $2 AND status = $3
`
@@ -872,7 +872,7 @@ const respondReviewGateTask = `-- name: RespondReviewGateTask :execrows
UPDATE tasks SET status = 'queued',
review_gate = $1::text,
rereview_rounds = rereview_rounds + CASE WHEN $2::bool THEN 1 ELSE 0 END,
park_reason = '', park_class = 'needs_human', updated_at = now()
park_reason = '', park_class = 'needs_decision', updated_at = now()
WHERE id = $3 AND status = $4
AND ($2::bool = false OR rereview_rounds < $5::bigint)
`
@@ -913,7 +913,7 @@ UPDATE tasks SET status = 'queued', retry_count = retry_count + 1,
workflow_definition_yaml = CASE WHEN $5::bool THEN '' ELSE workflow_definition_yaml END,
workflow_definition_digest = CASE WHEN $5::bool THEN '' ELSE workflow_definition_digest END,
workflow_definition_version = CASE WHEN $5::bool THEN 0 ELSE workflow_definition_version END,
park_reason = '', park_class = 'needs_human', updated_at = now()
park_reason = '', park_class = 'needs_decision', updated_at = now()
WHERE id = $6 AND status = $7
`
@@ -1249,7 +1249,7 @@ type TransitionTaskParams struct {
}
// Arriving at 'parked' also records why. The class is normalized by the
// caller, so an unknown value persists as needs_human rather than as itself.
// caller, so an unknown value persists as needs_decision rather than as itself.
func (q *Queries) TransitionTask(ctx context.Context, arg TransitionTaskParams) (int64, error) {
result, err := q.db.Exec(ctx, transitionTask,
arg.ID,