diff options
Diffstat (limited to 'internal/task')
| -rw-r--r-- | internal/task/task.go | 2 | ||||
| -rw-r--r-- | internal/task/task_test.go | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/internal/task/task.go b/internal/task/task.go index 2c57922..69da5f3 100644 --- a/internal/task/task.go +++ b/internal/task/task.go @@ -118,7 +118,7 @@ var validTransitions = map[State]map[State]bool{ StateTimedOut: {StateQueued: true}, // retry or resume StateCancelled: {StateQueued: true}, // restart StateBudgetExceeded: {StateQueued: true}, // retry - StateBlocked: {StateQueued: true, StateReady: true}, + StateBlocked: {StateQueued: true, StateReady: true, StateCancelled: true}, } // ValidTransition returns true if moving from the current state to next is allowed. diff --git a/internal/task/task_test.go b/internal/task/task_test.go index 9873084..15ba019 100644 --- a/internal/task/task_test.go +++ b/internal/task/task_test.go @@ -25,6 +25,7 @@ func TestValidTransition_AllowedTransitions(t *testing.T) { {"running to blocked (question)", StateRunning, StateBlocked}, {"blocked to queued (answer resume)", StateBlocked, StateQueued}, {"blocked to ready (parent unblocked by subtasks)", StateBlocked, StateReady}, + {"blocked to cancelled (user cancels)", StateBlocked, StateCancelled}, {"budget exceeded to queued (retry)", StateBudgetExceeded, StateQueued}, {"cancelled to queued (restart)", StateCancelled, StateQueued}, } |
