execution

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package execution records explicit attempts and prepares contract-valid work starts without running agents.

Index

Constants

View Source
const (
	PurposeUnknown           = "unknown"
	PurposeImplementation    = "implementation"
	PurposeVerification      = "verification"
	PurposeIndependentReview = "independent-review"
	PurposeOther             = "other"
)

Variables

View Source
var (
	ErrInvalidInput    = errors.New("invalid execution input")
	ErrProjectNotFound = errors.New("project not found")
	ErrProjectArchived = errors.New("project is archived")
	ErrIssueNotFound   = errors.New("current issue not found in project")
	ErrNotFound        = errors.New("execution not found in project")
	ErrFinished        = errors.New("execution already finished")
	ErrWorkStart       = errors.New("issue work-start transition failed")
)

Functions

This section is empty.

Types

type Aggregate added in v0.8.0

type Aggregate struct {
	Project                 string      `json:"project"`
	Issue                   string      `json:"issue"`
	AttemptIDs              []int64     `json:"attemptIds"`
	RetryLinks              []RetryLink `json:"retryLinks"`
	AttemptCount            int         `json:"attemptCount"`
	RetryCount              int         `json:"retryCount"`
	UnlinkedAttemptCount    int         `json:"unlinkedAttemptCount"`
	CompletedCount          int         `json:"completedCount"`
	UnfinishedCount         int         `json:"unfinishedCount"`
	SuccessfulCount         int         `json:"successfulCount"`
	FailedCount             int         `json:"failedCount"`
	CancelledCount          int         `json:"cancelledCount"`
	RecordedDurationSeconds float64     `json:"recordedDurationSeconds"`
	CoveredWallSeconds      float64     `json:"coveredWallSeconds"`
	ParallelOverlapSeconds  float64     `json:"parallelOverlapSeconds"`
	PeakConcurrency         int         `json:"peakConcurrency"`
	IntervalCompleteness    string      `json:"intervalCompleteness"`
	Truncated               bool        `json:"truncated"`
	Notes                   []string    `json:"notes"`
}

Aggregate is a read-only projection of explicit attempts. It never infers retries from ordering or overlap; RetryLinks are counted only when callers explicitly recorded retryOf.

type AggregateQuery added in v0.8.0

type AggregateQuery struct {
	Project, Issue string
	Limit          int
}

AggregateQuery selects the bounded attempts for one issue to summarize.

type Attempt

type Attempt struct {
	WorkStart          *issue.WorkStart `json:"workStart,omitempty"`
	ID                 int64            `json:"id"`
	ProjectID          int64            `json:"projectId"`
	ProjectKey         string           `json:"projectKey"`
	IssueKey           string           `json:"issueKey"`
	Executor           string           `json:"executor"`
	Host               string           `json:"host"`
	Ownership          string           `json:"ownership"`
	Purpose            string           `json:"purpose"`
	RetryOf            *int64           `json:"retryOf,omitempty"`
	Selection          string           `json:"selection"`
	RequestedModel     *string          `json:"requestedModel"`
	RequestedReasoning *string          `json:"requestedReasoning"`
	Observation
	Actor      string    `json:"actor"`
	StartedAt  time.Time `json:"startedAt"`
	RecordedAt time.Time `json:"recordedAt"`
	Finish     *Finish   `json:"finish"`
}

Attempt retains immutable start facts and, when present, a separate completion.

type Finish

type Finish struct {
	DurationSeconds float64 `json:"durationSeconds"`
	Outcome         string  `json:"outcome"`
	Evidence        string  `json:"evidence"`
	Observation
	Actor      string    `json:"actor"`
	FinishedAt time.Time `json:"finishedAt"`
	RecordedAt time.Time `json:"recordedAt"`
}

type FinishParams

type FinishParams struct {
	Project                  string
	ID                       int64
	Outcome, Evidence, Actor string
	Observation
	FinishedAt time.Time
}

type Observation

type Observation struct {
	EffectiveModel     *string `json:"effectiveModel"`
	EffectiveReasoning *string `json:"effectiveReasoning"`
	Source             string  `json:"source"`
	EvidenceSource     string  `json:"evidenceSource"`
}

Observation identifies the provenance of effective values. Nil means unknown; requested values are never substituted for missing effective values.

type Page

type Page struct {
	Executions []Attempt `json:"executions"`
	Limit      int       `json:"limit"`
	NextAfter  *int64    `json:"nextAfter"`
}

type Query

type Query struct {
	Project, Issue string
	After          int64
	Limit          int
}
type RetryLink struct {
	AttemptID int64 `json:"attemptId"`
	RetryOf   int64 `json:"retryOf"`
}

type StartParams

type StartParams struct {
	WorkState, ContinueReason                        string
	Project, Issue, Executor, Host, Ownership, Actor string
	Selection, Purpose                               string
	RetryOf                                          int64
	RequestedModel, RequestedReasoning               *string
	Observation
	StartedAt time.Time
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string) (*Store, error)

func OpenReadOnly

func OpenReadOnly(ctx context.Context, path string) (*Store, error)

func (*Store) Aggregate added in v0.8.0

func (s *Store) Aggregate(ctx context.Context, q AggregateQuery) (Aggregate, error)

Aggregate returns explicit retry and interval statistics for one issue. Finished attempt intervals are treated as [started, finished); unfinished attempts cannot contribute duration or concurrency coverage.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Complete

func (s *Store) Complete(ctx context.Context, p FinishParams) (Attempt, error)

Complete appends exactly one terminal result. It never changes start facts or issue state.

func (*Store) Get

func (s *Store) Get(ctx context.Context, project string, id int64) (Attempt, error)

func (*Store) List

func (s *Store) List(ctx context.Context, q Query) (Page, error)

List is bounded and ordered by immutable ID. Concurrent writes do not provide a snapshot across pages.

func (*Store) SetTrackerClientFactory added in v0.30.0

func (s *Store) SetTrackerClientFactory(factory func(context.Context, string, tracker.Config) (tracker.Client, error))

SetTrackerClientFactory replaces only the remote boundary for embedded callers and tests.

func (*Store) Start

func (s *Store) Start(ctx context.Context, p StartParams) (Attempt, error)

Start transitions the issue through a declared work-state edge when needed, then records one attempt and its audit event atomically. It never dispatches agents; attempts may overlap.

Jump to

Keyboard shortcuts

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