feat(statestore): CancelExecution, and one cancel path for daemon stop and operator actions

Plan item 5 of docs/prds/execution-tree-state-machine.md (archie-core-1217).
Until now a stop was a context cancel plus a caller-side transition, and the
step rows a worker still held running could never be told: the execution moved
while the work carried on, and the old interrupt-first ordering existed only
because the record could not defend itself. The step table can: the PRD's
ordering -- the store is the record, the context cancel is the delivery --
became safe the moment a worker's next step write fails ErrStaleTransition
against a cancelled step.

- storecontract.ExecutionCanceller and the CancelExecution RPC: one
  transaction moves every non-terminal StepExecution of the execution's
  current attempt to cancelled (one event row each, in the same
  transaction), and the execution itself to the status the operator action
  names, under the shared transition table with its audit row. Staleness is
  decided before legality, the way guardTransition decides it. Earlier
  attempts are never rewritten. Deliberately administrative: the
  deny-by-default grant rule covers it, pinned by a test.
- taskactions.Service routes stop, cancel, abandon and reject through it and
  the old Transition/CancelTask combinations are deleted; the daemon's
  in-memory cancel is demoted to the delivery hook the PRD names, called
  after the store record.
- The gateway's chat controller records first and delivers second, the same
  order, and records even when no runtime is wired here (a standalone
  gateway cannot reach the daemon's goroutines): the record is what unsticks
  a lost-cancel task, and the delivery is best effort. StopRunning and
  TaskRuntime.CancelRunningTasks are deleted outright -- no production
  caller remained once the task_action tool owned stopping, and the daemon's
  CancelRunningTasks/runningTasks.stopAll go with them.
- The gateway's chat adapter writes through CancelExecution instead of a
  bare Transition, so chat /cancel and the dashboard's action service land
  on the same path.

PRD decisions recorded here:
- Each cancelled step's event row is stage_finish with {cancelled: true} and
  the reason as its detail -- the exact-one-event-per-step-transition rule
  covers the pending -> cancelled transition too, even for a step that never
  ran.
- A parked cancel carries the needs_human class, matching the Transition
  path this replaces; the transient class stays with parkRunningTask's
  unwind parks, which now meet ErrStaleTransition for cancelled runs and are
  ignored there.
- Cancelling a wait:true callee is deferred to #1216's agent-call children:
  the callee's own tree and the wait flag are what make
  "cancelling a caller cancels each callee it waits on" decidable, and the
  callee writes it cannot fake are this issue's half of the contract.
- RecoverStale's interrupted sweep is plan item 6, untouched here.
This commit is contained in:
sam committed 2026-09-27 06:34:01 +10:00
1 parent 68c634edfe
commit cb2ca07d0b
29 files changed
+1646 -1028

No files matched your search

@@ -0,0 +1,194 @@
package postgres
import (
"errors"
"testing"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
task "github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/taskstate"
)
// CancelExecution is the one cancel path (docs/prds/execution-tree-state-machine.md,
// "Cancellation"): one transaction cancels every non-terminal StepExecution of
// the execution's current attempt and moves the execution to the status the
// operator action names, with one event row per step transition and the
// execution's own audit row in the same write.
func TestCancelExecutionCancelsTheAttemptsStepsAndTheExecution(t *testing.T) {
s := storeFor(t)
execution := runningExecution(t, s)
stageID, _, err := s.StartStep(t.Context(), task.StepStart{
ExecutionID: execution.ID, Attempt: execution.Attempt, Kind: task.StepKindStage, Name: "review",
})
if err != nil {
t.Fatalf("StartStep stage: %v", err)
}
childID, _, err := s.StartStep(t.Context(), task.StepStart{
ExecutionID: execution.ID, Attempt: execution.Attempt,
ParentID: stageID, Kind: task.StepKindAgent, Name: "review:1",
})
if err != nil {
t.Fatalf("StartStep child: %v", err)
}
if _, err := s.FinishStep(t.Context(), task.StepFinish{
StepID: stageID, ExecutionID: execution.ID,
From: taskstate.StepRunning, To: taskstate.StepSucceeded, Detail: "done",
}); err != nil {
t.Fatalf("FinishStep: %v", err)
}
steps, err := s.CancelExecution(t.Context(), execution.ID, "stopped by operator", taskstate.Parked)
if err != nil {
t.Fatalf("CancelExecution: %v", err)
}
if len(steps) != 1 || steps[0] != childID {
t.Fatalf("cancelled steps = %v, want only the non-terminal %d", steps, childID)
}
// Every non-terminal step of the current attempt is cancelled; the one
// that already finished is never rewritten.
var statuses map[int64]string
if err := s.pool.QueryRow(t.Context(),
`SELECT jsonb_object_agg(id, status) FROM step_executions WHERE execution_id = $1`,
execution.ID).Scan(&statuses); err != nil {
t.Fatalf("read steps: %v", err)
}
if statuses[stageID] != string(taskstate.StepSucceeded) || statuses[childID] != string(taskstate.StepCancelled) {
t.Fatalf("statuses = %v, want the finished step kept and the child cancelled", statuses)
}
got, err := s.TaskByID(t.Context(), execution.ID)
if err != nil || got == nil {
t.Fatalf("TaskByID: %+v %v", got, err)
}
if got.Status != taskstate.Parked || got.ParkReason != "stopped by operator" {
t.Fatalf("execution after cancel = %s (%q), want parked with the reason", got.Status, got.ParkReason)
}
}
func TestCancelExecutionWritesOneEventPerCancelledStep(t *testing.T) {
s := storeFor(t)
execution := runningExecution(t, s)
stageID, _, err := s.StartStep(t.Context(), task.StepStart{
ExecutionID: execution.ID, Attempt: execution.Attempt, Kind: task.StepKindStage, Name: "implement",
})
if err != nil {
t.Fatalf("StartStep: %v", err)
}
if _, _, err := s.StartStep(t.Context(), task.StepStart{
ExecutionID: execution.ID, Attempt: execution.Attempt,
ParentID: stageID, Kind: task.StepKindAgent, Name: "implement",
}); err != nil {
t.Fatalf("StartStep child: %v", err)
}
if _, err := s.CancelExecution(t.Context(), execution.ID, "stopped by operator", taskstate.Parked); err != nil {
t.Fatalf("CancelExecution: %v", err)
}
evs, err := s.TaskEvents(t.Context(), execution.ID)
if err != nil {
t.Fatalf("TaskEvents: %v", err)
}
var cancelled []events.Event
for _, e := range evs {
if e.Data["cancelled"] == true {
cancelled = append(cancelled, e)
}
}
if len(cancelled) != 2 {
t.Fatalf("cancel events = %d, want one per step the transaction cancelled", len(cancelled))
}
for _, e := range cancelled {
if e.Kind != events.KindStageFinish || e.Attempt != execution.Attempt {
t.Errorf("cancel event = %+v, want a stage_finish row attributed to the attempt", e)
}
}
}
func TestCancelExecutionLeavesEarlierAttemptsAlone(t *testing.T) {
s := storeFor(t)
execution := runningExecution(t, s)
firstAttempt := execution.Attempt
stepID, _, err := s.StartStep(t.Context(), task.StepStart{
ExecutionID: execution.ID, Attempt: firstAttempt, Kind: task.StepKindStage, Name: "implement",
})
if err != nil {
t.Fatalf("StartStep: %v", err)
}
if _, err := s.FinishStep(t.Context(), task.StepFinish{
StepID: stepID, ExecutionID: execution.ID,
From: taskstate.StepRunning, To: taskstate.StepSucceeded,
}); err != nil {
t.Fatalf("FinishStep: %v", err)
}
// A retry requeues and reclaims: attempt 2.
if err := s.Requeue(t.Context(), execution.ID, taskstate.Running, "implement"); err != nil {
t.Fatalf("Requeue: %v", err)
}
retried, err := s.ClaimNext(t.Context())
if err != nil || retried == nil {
t.Fatalf("ClaimNext: %+v %v", retried, err)
}
if _, err := s.CancelExecution(t.Context(), execution.ID, "stopped by operator", taskstate.Parked); err != nil {
t.Fatalf("CancelExecution: %v", err)
}
var firstAttemptStatuses []string
if err := s.pool.QueryRow(t.Context(),
`SELECT jsonb_agg(status) FROM step_executions WHERE execution_id = $1 AND attempt = $2`,
execution.ID, firstAttempt).Scan(&firstAttemptStatuses); err != nil {
t.Fatalf("read first attempt's steps: %v", err)
}
for _, status := range firstAttemptStatuses {
if status != string(taskstate.StepSucceeded) {
t.Errorf("an earlier attempt's step was rewritten to %q; history is never rewritten", status)
}
}
}
func TestCancelExecutionRefusesWhatTheTableForbids(t *testing.T) {
tests := []struct {
name string
target string
want error
}{
{name: "a terminal execution", target: taskstate.Queued, want: storecontract.ErrIllegalTransition},
{name: "an unroutable destination", target: "quantum", want: storecontract.ErrIllegalTransition},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := storeFor(t)
execution := runningExecution(t, s)
if tt.name == "a terminal execution" {
// completed is terminal: the table routes nothing out of it.
if err := s.Transition(t.Context(), execution.ID, taskstate.Running, taskstate.Completed, "done"); err != nil {
t.Fatalf("seed completed: %v", err)
}
}
if _, err := s.CancelExecution(t.Context(), execution.ID, "why", tt.target); !errors.Is(err, tt.want) {
t.Fatalf("CancelExecution(to=%q) = %v, want %v", tt.target, err, tt.want)
}
})
}
// A queued execution cancels fine: the table routes queued -> closed_wont_do.
s := storeFor(t)
execution := runningExecution(t, s)
if err := s.Transition(t.Context(), execution.ID, taskstate.Running, taskstate.Queued, "requeue"); err != nil {
t.Fatalf("seed queued: %v", err)
}
if _, err := s.CancelExecution(t.Context(), execution.ID, "cancelled by operator", taskstate.Declined); err != nil {
t.Fatalf("CancelExecution(queued -> closed_wont_do) = %v, want nil", err)
}
}
func TestCancelExecutionOnAMissingExecutionIsStale(t *testing.T) {
s := storeFor(t)
if _, err := s.CancelExecution(t.Context(), 999999, "why", taskstate.Parked); !errors.Is(err, storecontract.ErrStaleTransition) {
t.Fatalf("CancelExecution on a missing execution = %v, want ErrStaleTransition", err)
}
}
@@ -11,6 +11,47 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
const cancelAttemptSteps = `-- name: CancelAttemptSteps :many
UPDATE step_executions
SET status = 'cancelled', finished_at = now()
WHERE execution_id = $1 AND attempt = $2 AND status IN ('pending', 'running')
RETURNING id, name
`
type CancelAttemptStepsParams struct {
ExecutionID int64
Attempt int64
}
type CancelAttemptStepsRow struct {
ID int64
Name string
}
// The half of CancelExecution that cancels the current attempt's
// non-terminal steps, returning them so the store writes one event row per
// transition in the same transaction. Earlier attempts' rows never match:
// history is never rewritten.
func (q *Queries) CancelAttemptSteps(ctx context.Context, arg CancelAttemptStepsParams) ([]CancelAttemptStepsRow, error) {
rows, err := q.db.Query(ctx, cancelAttemptSteps, arg.ExecutionID, arg.Attempt)
if err != nil {
return nil, err
}
defer rows.Close()
var items []CancelAttemptStepsRow
for rows.Next() {
var i CancelAttemptStepsRow
if err := rows.Scan(&i.ID, &i.Name); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const finishStepExecution = `-- name: FinishStepExecution :execrows
UPDATE step_executions
SET status = $1, detail = $2, tokens_used = $3, finished_at = now()
@@ -33,4 +33,13 @@ FROM step_executions WHERE id = $1 FOR UPDATE;
-- name: FinishStepExecution :execrows
UPDATE step_executions
SET status = $1, detail = $2, tokens_used = $3, finished_at = now()
WHERE id = $4 AND status = $5;
WHERE id = $4 AND status = $5;
-- name: CancelAttemptSteps :many
-- The half of CancelExecution that cancels the current attempt's
-- non-terminal steps, returning them so the store writes one event row per
-- transition in the same transaction. Earlier attempts' rows never match:
-- history is never rewritten.
UPDATE step_executions
SET status = 'cancelled', finished_at = now()
WHERE execution_id = $1 AND attempt = $2 AND status IN ('pending', 'running')
RETURNING id, name;
+67
View File
@@ -230,3 +230,70 @@ func stepEventData(to taskstate.StepStatus, durationMS int64, detail string) map
func stepParentID(parentID int64) pgtype.Int8 {
return pgtype.Int8{Int64: parentID, Valid: parentID != 0}
}
// CancelExecution is the one cancel path (docs/prds/execution-tree-state-machine.md,
// "Cancellation"): one transaction moves every non-terminal StepExecution of
// the execution's current attempt to cancelled -- one event row each -- and
// the execution itself to the status the operator action names, under the
// shared execution transition table. Staleness is decided before legality, as
// guardTransition decides it, and the audit row lands in the same write. The
// caller cancels the in-memory context after this commits; the worker's next
// step write then fails ErrStaleTransition and stops.
func (s *Store) CancelExecution(ctx context.Context, taskID int64, reason, to string) ([]int64, error) {
tx, err := s.pool.Begin(ctx)
if err != nil {
return nil, err
}
defer func() { _ = tx.Rollback(ctx) }()
q := postgresdb.New(tx)
execution, err := q.LockExecutionForStep(ctx, taskID)
if errors.Is(err, pgx.ErrNoRows) {
return nil, storecontract.ErrStaleTransition
}
if err != nil {
return nil, err
}
if !taskstate.CanTransition(execution.Status, to) {
return nil, fmt.Errorf("%w: %s -> %s is not a transition",
storecontract.ErrIllegalTransition, execution.Status, to)
}
steps, err := q.CancelAttemptSteps(ctx, postgresdb.CancelAttemptStepsParams{
ExecutionID: taskID, Attempt: execution.Attempt,
})
if err != nil {
return nil, err
}
for _, step := range steps {
if _, err := insertEventQ(ctx, q, stepEvent(events.KindStageFinish, execution.ID,
execution.Owner, execution.Repo, execution.IssueNumber, execution.Workflow,
int(execution.Attempt), step.Name, map[string]any{"cancelled": true})); err != nil {
return nil, err
}
}
n, err := q.TransitionTask(ctx, postgresdb.TransitionTaskParams{
ID: taskID, Status: to, ParkReason: clip(reason, 4000),
ParkClass: taskstate.ParkNeedsHuman, Status_2: execution.Status,
})
if err != nil {
return nil, err
}
if n == 0 {
return nil, storecontract.ErrStaleTransition
}
if err := q.InsertTransition(ctx, postgresdb.InsertTransitionParams{
TaskID: taskID, FromStatus: execution.Status, ToStatus: to, Detail: clip(reason, 4000),
}); err != nil {
return nil, err
}
if err := tx.Commit(ctx); err != nil {
return nil, err
}
ids := make([]int64, 0, len(steps))
for _, step := range steps {
ids = append(ids, step.ID)
}
return ids, nil
}
@@ -125,6 +125,7 @@ func taskFromRow(t postgresdb.Task) *workflow.Task {
var (
_ storecontract.TaskStore = (*Store)(nil)
_ storecontract.StepRecorder = (*Store)(nil)
_ storecontract.ExecutionCanceller = (*Store)(nil)
_ storecontract.BindingTaskCreator = (*Store)(nil)
_ storecontract.ConfigSnapshotStore = (*Store)(nil)
_ storecontract.ChannelStatusStore = (*Store)(nil)
@@ -58,6 +58,7 @@ var (
_ storecontract.ConfigSnapshotStore = (*Client)(nil)
_ storecontract.ChannelStatusStore = (*Client)(nil)
_ storecontract.ApplyStatusStore = (*Client)(nil)
_ storecontract.ExecutionCanceller = (*Client)(nil)
_ identity.Repository = (*Client)(nil)
_ storepkg.Manager = (*Client)(nil)
)
@@ -127,6 +128,18 @@ func (c *Client) StartStep(ctx context.Context, s task.StepStart) (int64, events
return r.StepId, event, nil
}
// CancelExecution is the one cancel path (docs/prds/execution-tree-state-machine.md):
// the State Store records the cancellation -- every non-terminal step of the
// current attempt plus the execution's own move -- and returns the steps it
// cancelled; the caller cancels the run's in-memory context afterwards.
func (c *Client) CancelExecution(ctx context.Context, taskID int64, reason, to string) ([]int64, error) {
r, err := c.client.CancelExecution(ctx, &pb.CancelExecutionRequest{TaskId: taskID, Reason: reason, To: to})
if err != nil {
return nil, unmapError(err)
}
return r.CancelledStepIds, nil
}
func (c *Client) FinishStep(ctx context.Context, s task.StepFinish) (events.Event, error) {
r, err := c.client.FinishStep(ctx, &pb.FinishStepRequest{
ExecutionId: s.ExecutionID, StepId: s.StepID,
@@ -28,6 +28,7 @@ import (
type contract interface {
storecontract.TaskStore
storecontract.StepRecorder
storecontract.ExecutionCanceller
storecontract.BindingTaskCreator
storecontract.ConfigSnapshotStore
storecontract.ApplyStatusStore
@@ -84,6 +85,7 @@ func remoteTaskStore(t *testing.T, local *pgstore.TaskDB, logs storecontract.Tas
server := grpc.NewServer()
deps := Deps{
Tasks: local, BindingTaskCreator: local, WorkflowCalls: local, Steps: local,
Canceller: local,
ConfigSnapshots: local, ApplyStatus: local,
TaskLogs: logs,
}
@@ -400,6 +402,16 @@ func TestStateStoreConformance(t *testing.T) {
t.Fatalf("ClaimByIssue missing: %+v %v", byClaim, err)
}
// The one cancel path, at the battery's end where the task's
// status is whatever the lifecycle section left: both adapters
// cancel the attempt's non-terminal steps and move the execution
// in one write, and the archive below then reads the parked row.
cancelled, err := c.CancelExecution(ctx, task.ID, "declined by operator", "closed_wont_do")
if err != nil {
t.Fatalf("CancelExecution: %v", err)
}
_ = cancelled
// Archive. RecoverStale above may have requeued task if it was
// still running, so re-fetch its current status rather than
// trusting the in-memory snapshot.
@@ -407,6 +419,9 @@ func TestStateStoreConformance(t *testing.T) {
if err != nil || current == nil {
t.Fatalf("TaskByID before archive: %+v %v", current, err)
}
if current.Status != "closed_wont_do" {
t.Fatalf("execution after cancel = %q, want closed_wont_do", current.Status)
}
if _, err := c.ArchiveTask(ctx, task.ID, current.Status, events.Event{Kind: "archived"}); err != nil {
t.Fatalf("ArchiveTask: %v", err)
}
@@ -102,6 +102,10 @@ type Deps struct {
// workflow engine's run credential calls. Optional: nil answers both RPCs
// with codes.Unavailable.
Steps storecontract.StepRecorder
// Canceller is the one cancel path (docs/prds/execution-tree-state-machine.md):
// an operator action's guarded write over the execution and its steps.
// Optional: nil answers the RPC with codes.Unavailable.
Canceller storecontract.ExecutionCanceller
// PlaybookDispatcher is the side-effecting-action idempotency ledger
// (docs/prds/eda-playbook-engine.md gap 2). Optional: nil disables the
// two playbook dispatch RPCs with codes.Unavailable.
@@ -214,6 +218,20 @@ func (s *server) StartStep(ctx context.Context, r *pb.StartStepRequest) (*pb.Sta
return &pb.StartStepResponse{StepId: stepID, Event: eventProto(event)}, nil
}
// CancelExecution is the one cancel path (docs/prds/execution-tree-state-machine.md):
// the store records the cancellation and returns the steps it cancelled; the
// caller delivers it by cancelling the run's in-memory context afterwards.
func (s *server) CancelExecution(ctx context.Context, r *pb.CancelExecutionRequest) (*pb.CancelExecutionResponse, error) {
if s.deps.Canceller == nil {
return nil, status.Error(codes.Unavailable, "execution canceller unavailable")
}
ids, err := s.deps.Canceller.CancelExecution(ctx, r.TaskId, r.Reason, r.To)
if err != nil {
return nil, s.logErr("CancelExecution", err)
}
return &pb.CancelExecutionResponse{CancelledStepIds: ids}, nil
}
func (s *server) FinishStep(ctx context.Context, r *pb.FinishStepRequest) (*pb.FinishStepResponse, error) {
if s.deps.Steps == nil {
return nil, status.Error(codes.Unavailable, "step recorder unavailable")
@@ -44,7 +44,8 @@ func grantsServer(t *testing.T, adminToken string) (grants *TaskGrants, dial fun
Captures: eda, Mappings: eda, Bindings: eda,
BindingDispatcher: eda, PlaybookDispatcher: eda, EventTypes: eda,
BindingTaskCreator: local, WorkflowCalls: local, Steps: local,
Grants: grants,
Canceller: local,
Grants: grants,
})
go func() { _ = server.Serve(listener) }()
t.Cleanup(func() { server.Stop(); _ = listener.Close() })
@@ -457,3 +458,29 @@ func TestRunCredentialRecordsItsOwnSteps(t *testing.T) {
t.Fatalf("FinishStep naming another execution = %v, want PermissionDenied from the grant check", err)
}
}
// A task-scoped grant never reaches CancelExecution: a cancel is a dashboard,
// API and dispatch action decided by the Authorizer
// (docs/prds/execution-tree-state-machine.md), and the deny-by-default rule
// covers it without a widening.
func TestTaskGrantCannotCancelAnExecution(t *testing.T) {
const adminToken = "daemon-admin-token"
grants, dial := grantsServer(t, adminToken)
_ = grants
admin := dial(t, adminToken)
ctx := t.Context()
task, err := admin.EnqueueChatTask(ctx, "acme", "widget", "a", "body", "implement", "")
if err != nil {
t.Fatal(err)
}
workerToken, err := admin.RegisterTaskGrant(ctx, task.ID, time.Hour)
if err != nil {
t.Fatalf("RegisterTaskGrant: %v", err)
}
worker := dial(t, workerToken)
if _, err := worker.CancelExecution(ctx, task.ID, "why", "parked"); status.Code(err) != codes.PermissionDenied {
t.Fatalf("CancelExecution with a task grant = %v, want PermissionDenied", err)
}
}
@@ -42,8 +42,11 @@ type stubStore struct {
func (s stubStore) TaskByID(context.Context, int64) (*domain.Task, error) { return s.task, nil }
func (s stubStore) Transition(context.Context, int64, string, string, string) error { return s.err }
func (s stubStore) Requeue(context.Context, int64, string, string) error { return s.err }
func (s stubStore) RetryTask(context.Context, int64, string, string) error { return s.err }
func (s stubStore) CancelExecution(context.Context, int64, string, string) ([]int64, error) {
return nil, s.err
}
func (s stubStore) Requeue(context.Context, int64, string, string) error { return s.err }
func (s stubStore) RetryTask(context.Context, int64, string, string) error { return s.err }
func (s stubStore) ArchiveTask(context.Context, int64, string, events.Event) (int64, error) {
return 0, s.err
@@ -3,6 +3,7 @@ package taskactions
import (
"context"
"fmt"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
@@ -19,6 +20,19 @@ func (s Store) TaskByID(ctx context.Context, id int64) (*taskactions.Task, error
return &taskactions.Task{ID: t.ID, Owner: t.Owner, Repo: t.Repo, Identity: t.Identity, Status: t.Status, Stage: t.Stage, ParkReason: t.ParkReason, IssueNumber: t.IssueNumber, RetryCount: t.RetryCount, Attempt: t.Attempt, ForgeBacked: t.IsForgeBacked()}, nil
}
// CancelExecution delegates to the store's one cancel path
// (docs/prds/execution-tree-state-machine.md). Both adapters -- the
// PostgreSQL store and the remote gRPC client -- implement it; the type
// assertion failing would be a composition bug, so it is named rather than
// panicked over.
func (s Store) CancelExecution(ctx context.Context, taskID int64, reason, to string) ([]int64, error) {
canceller, ok := s.TaskStore.(storecontract.ExecutionCanceller)
if !ok {
return nil, fmt.Errorf("task store cannot cancel executions")
}
return canceller.CancelExecution(ctx, taskID, reason, to)
}
func MaxRetries(cfg *config.Holder) func(*taskactions.Task) int {
return func(t *taskactions.Task) int {
if cfg == nil {