summaryrefslogtreecommitdiff
path: root/internal/task
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-03 21:15:01 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-03 21:15:01 +0000
commit704d007a26cac804148a51d35e129beaea382fb0 (patch)
tree5061ca129ea033e8689d0a5bdc9d7ddbb9c09f56 /internal/task
parent58f1f0909b8329b1219c5de9d0df2b4c6c93fec9 (diff)
Add subtask support: parent_task_id, ListSubtasks, UpdateTask
- Task struct gains ParentTaskID field - DB schema adds parent_task_id column (additive migration) - DB.ListSubtasks fetches children of a parent task - DB.UpdateTask allows partial field updates (name, description, state, etc.) - Templates table added to initial schema Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/task')
-rw-r--r--internal/task/task.go7
-rw-r--r--internal/task/task_test.go2
2 files changed, 7 insertions, 2 deletions
diff --git a/internal/task/task.go b/internal/task/task.go
index 5c28f63..d360a07 100644
--- a/internal/task/task.go
+++ b/internal/task/task.go
@@ -34,6 +34,7 @@ type ClaudeConfig struct {
DisallowedTools []string `yaml:"disallowed_tools" json:"disallowed_tools"`
SystemPromptAppend string `yaml:"system_prompt_append" json:"system_prompt_append"`
AdditionalArgs []string `yaml:"additional_args" json:"additional_args"`
+ SkipPlanning bool `yaml:"skip_planning" json:"skip_planning"`
}
type RetryConfig struct {
@@ -42,8 +43,9 @@ type RetryConfig struct {
}
type Task struct {
- ID string `yaml:"id" json:"id"`
- Name string `yaml:"name" json:"name"`
+ ID string `yaml:"id" json:"id"`
+ ParentTaskID string `yaml:"parent_task_id" json:"parent_task_id"`
+ Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Claude ClaudeConfig `yaml:"claude" json:"claude"`
Timeout Duration `yaml:"timeout" json:"timeout"`
@@ -90,6 +92,7 @@ func ValidTransition(from, to State) bool {
StateQueued: {StateRunning, StateCancelled},
StateRunning: {StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded},
StateFailed: {StateQueued}, // retry
+ StateTimedOut: {StateQueued}, // retry
}
for _, allowed := range transitions[from] {
if allowed == to {
diff --git a/internal/task/task_test.go b/internal/task/task_test.go
index 96f5f6f..a8e0a84 100644
--- a/internal/task/task_test.go
+++ b/internal/task/task_test.go
@@ -21,6 +21,7 @@ func TestValidTransition_AllowedTransitions(t *testing.T) {
{"running to cancelled", StateRunning, StateCancelled},
{"running to budget exceeded", StateRunning, StateBudgetExceeded},
{"failed to queued (retry)", StateFailed, StateQueued},
+ {"timed out to queued (retry)", StateTimedOut, StateQueued},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -43,6 +44,7 @@ func TestValidTransition_DisallowedTransitions(t *testing.T) {
{"completed to running", StateCompleted, StateRunning},
{"completed to queued", StateCompleted, StateQueued},
{"failed to completed", StateFailed, StateCompleted},
+ {"timed out to completed", StateTimedOut, StateCompleted},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {