summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/task/task.go7
-rw-r--r--internal/task/task_test.go1
2 files changed, 5 insertions, 3 deletions
diff --git a/internal/task/task.go b/internal/task/task.go
index 8bb3214..447c4a3 100644
--- a/internal/task/task.go
+++ b/internal/task/task.go
@@ -121,9 +121,10 @@ func ValidTransition(from, to State) bool {
StateRunning: {StateReady, StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded, StateBlocked},
StateReady: {StateCompleted, StatePending},
StateFailed: {StateQueued}, // retry
- StateTimedOut: {StateQueued}, // retry
- StateCancelled: {StateQueued}, // restart
- StateBlocked: {StateQueued, StateReady}, // answer received → re-queue as resume execution
+ StateTimedOut: {StateQueued}, // retry
+ StateCancelled: {StateQueued}, // restart
+ StateBudgetExceeded: {StateQueued}, // retry
+ StateBlocked: {StateQueued, StateReady}, // answer received → re-queue as resume execution
}
for _, allowed := range transitions[from] {
if allowed == to {
diff --git a/internal/task/task_test.go b/internal/task/task_test.go
index 5cb12d0..637baf5 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},
+ {"budget exceeded to queued (retry)", StateBudgetExceeded, StateQueued},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {