summaryrefslogtreecommitdiff
path: root/internal/task/task.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/task/task.go')
-rw-r--r--internal/task/task.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/task/task.go b/internal/task/task.go
index 3e74a82..587993f 100644
--- a/internal/task/task.go
+++ b/internal/task/task.go
@@ -14,6 +14,7 @@ const (
StateTimedOut State = "TIMED_OUT"
StateCancelled State = "CANCELLED"
StateBudgetExceeded State = "BUDGET_EXCEEDED"
+ StateBlocked State = "BLOCKED"
)
type Priority string
@@ -56,6 +57,7 @@ type Task struct {
DependsOn []string `yaml:"depends_on" json:"depends_on"`
State State `yaml:"-" json:"state"`
RejectionComment string `yaml:"-" json:"rejection_comment,omitempty"`
+ QuestionJSON string `yaml:"-" json:"question,omitempty"`
CreatedAt time.Time `yaml:"-" json:"created_at"`
UpdatedAt time.Time `yaml:"-" json:"updated_at"`
}
@@ -92,10 +94,11 @@ func ValidTransition(from, to State) bool {
transitions := map[State][]State{
StatePending: {StateQueued, StateCancelled},
StateQueued: {StateRunning, StateCancelled},
- StateRunning: {StateReady, StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded},
+ StateRunning: {StateReady, StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded, StateBlocked},
StateReady: {StateCompleted, StatePending},
StateFailed: {StateQueued}, // retry
StateTimedOut: {StateQueued}, // retry
+ StateBlocked: {StateQueued}, // answer received → re-queue as resume execution
}
for _, allowed := range transitions[from] {
if allowed == to {