Documentation
¶
Index ¶
- Constants
- func Now() int64
- type Store
- func (s *Store) Claim(taskID, sessionID, branchName, worktreePath string) (bool, error)
- func (s *Store) Create(task *Task) error
- func (s *Store) Delete(id string) error
- func (s *Store) FailStuckTasks() ([]*Task, error)
- func (s *Store) Get(id string) (*Task, error)
- func (s *Store) GetReadyTasks(planID string) ([]*Task, error)
- func (s *Store) ListByPlan(planID string) ([]*Task, error)
- func (s *Store) ResetFailed(id string) error
- func (s *Store) Update(task *Task) error
- func (s *Store) UpdateStatus(id string, status string) error
- type Task
Constants ¶
const ( StatusPending = "pending" StatusInProgress = "in_progress" StatusCompleted = "completed" StatusFailed = "failed" )
Task statuses
const ( EffortS = "S" EffortM = "M" EffortL = "L" EffortXL = "XL" )
Effort levels
const ( ComplexityLow = "low" ComplexityMedium = "medium" ComplexityHigh = "high" )
Complexity levels
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Claim ¶
Claim atomically transitions a pending task to in_progress. It sets the session_id, branch_name, and worktree_path in a single UPDATE that only succeeds when the task is still pending with no session assigned. Returns false (no error) when another goroutine already claimed the task.
func (*Store) FailStuckTasks ¶
FailStuckTasks marks every in_progress task as failed. Called on server startup to recover tasks that were running when the server was last shut down or crashed. Returns the tasks that were marked as failed (including their branch_name and worktree_path) so cleanup can be performed.
func (*Store) ResetFailed ¶
ResetFailed atomically clears all runtime state on a failed task and sets it back to pending so it can be re-executed cleanly. The UPDATE is conditional on status=failed so concurrent calls are safe.
type Task ¶
type Task struct {
ID string `json:"id"`
PlanID string `json:"planId"`
SessionID *string `json:"sessionId,omitempty"`
ParentTaskID *string `json:"parentTaskId,omitempty"`
Title string `json:"title"`
Description string `json:"description"`
Effort string `json:"effort"` // S, M, L, XL
Complexity string `json:"complexity"` // low, medium, high
Status string `json:"status"` // pending, in_progress, completed, failed
Dependencies []string `json:"dependencies"` // task IDs this task depends on
BranchName string `json:"branchName"`
ChainBranch string `json:"chainBranch,omitempty"` // shared branch for a dependency chain; empty for standalone tasks
WorktreePath string `json:"worktreePath,omitempty"`
PRURL string `json:"prUrl,omitempty"`
PRNumber *int `json:"prNumber,omitempty"`
PRError string `json:"prError,omitempty"` // non-empty when PR creation was skipped or failed
Model string `json:"model,omitempty"` // per-task model override; empty = inherit the plan's model
OrderIndex int `json:"orderIndex"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
Task represents a unit of work derived from a locked Plan. Each task is executed in its own git branch with an isolated agent session.