blocker

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package blocker detects blocked tasks and generates AI-powered resolution suggestions. A task is considered blocked if any of the following heuristics fire:

  • It is in_progress and no artifact or checkpoint file has been touched in >30 min
  • It has at least one failed dependency
  • Any of its annotations contains the word "blocked"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockReason

type BlockReason string

BlockReason describes why a task was classified as blocked.

const (
	BlockReasonStalled    BlockReason = "stalled"    // in_progress, no activity >30 min
	BlockReasonFailedDep  BlockReason = "failed_dep" // a dependency task has failed
	BlockReasonAnnotation BlockReason = "annotation" // annotation explicitly mentions "blocked"
)

type BlockerInfo

type BlockerInfo struct {
	TaskID    int           `json:"task_id"`
	TaskTitle string        `json:"task_title"`
	Blocked   bool          `json:"blocked"`
	Reasons   []BlockReason `json:"reasons,omitempty"`
	// StalledSince is set when BlockReasonStalled is detected.
	StalledSince *time.Time `json:"stalled_since,omitempty"`
	// FailedDeps contains the IDs of failed dependency tasks.
	FailedDeps []int `json:"failed_deps,omitempty"`
}

BlockerInfo holds the detection results for a single task.

func Detect

func Detect(workDir string, task *pm.Task, plan *pm.Plan) *BlockerInfo

Detect checks whether a task is blocked without calling the AI. workDir is used to inspect checkpoint and artifact file mtimes.

func DetectAll

func DetectAll(workDir string, plan *pm.Plan) []*BlockerInfo

DetectAll scans every task in the plan and returns blocked tasks only.

type BlockerReport

type BlockerReport struct {
	TaskID         int          `json:"task_id"`
	TaskTitle      string       `json:"task_title"`
	Detection      *BlockerInfo `json:"detection"`
	RootCause      string       `json:"root_cause"`
	Actions        []string     `json:"actions"`        // exactly 3 concrete unblocking steps
	Recommendation string       `json:"recommendation"` // "retry", "skip", or "reassign"
}

BlockerReport is the full AI-generated analysis for a blocked task.

func Analyze

func Analyze(ctx context.Context, p provider.Provider, model string, timeout time.Duration, task *pm.Task, plan *pm.Plan, workDir string) (*BlockerReport, error)

Analyze calls the AI provider to produce a BlockerReport for the given task. The AI receives the task spec, detection reasons, failure/timeout history, and dependency statuses, then outputs root-cause + 3 unblocking actions + a retry/skip/reassign recommendation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL