pipeline

package
v0.3.140 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package pipeline orchestrates review pipeline phases without owning command IO.

Index

Constants

This section is empty.

Variables

View Source
var ErrStructuredOutputInvalidAfterRetry = llm.ErrStructuredOutputInvalidAfterRetry

ErrStructuredOutputInvalidAfterRetry marks a selector or rollup response that stayed invalid after the LLM retry path.

Functions

This section is empty.

Types

type ArtifactPaths

type ArtifactPaths struct {
	Dir              string `json:"dir"`
	DiffPatch        string `json:"diff_patch"`
	SlicesDir        string `json:"slices_dir"`
	FindingsJSON     string `json:"findings_json"`
	RollupMarkdown   string `json:"rollup_markdown"`
	AgentSourcesJSON string `json:"agent_sources_json"`
	AgentLogsDir     string `json:"agent_logs_dir"`
}

ArtifactPaths contains per-run artifact paths.

func ArtifactPathsForRun

func ArtifactPathsForRun(layout statepaths.Layout, ref gitprovider.PRRef, pr gitprovider.PR, profile, postingIdentity, runID string) (ArtifactPaths, error)

ArtifactPathsForRun returns the artifact paths for a generated run ID.

func ArtifactPathsFromDir

func ArtifactPathsFromDir(dir string) ArtifactPaths

ArtifactPathsFromDir returns the artifact path set rooted at dir.

func (ArtifactPaths) AgentLog

func (p ArtifactPaths) AgentLog(agentID string) (string, error)

AgentLog returns the tailable LLM log path for an agent.

func (ArtifactPaths) SlicePatch

func (p ArtifactPaths) SlicePatch(agentID, filePath string) (string, error)

SlicePatch returns the artifact path for an agent/file diff slice.

type ContextBudget

type ContextBudget struct {
	MaxPromptBytes int
}

ContextBudget limits prompt size. A negative MaxPromptBytes disables checks.

type FilePatch

type FilePatch struct {
	OldPath string
	Path    string
	Patch   string
	Binary  bool
	Deleted bool
	Hunks   []reviewplan.DiffHunk
}

FilePatch is one whole-file diff slice.

type NamedSessionStore

type NamedSessionStore interface {
	GetNamedSession(context.Context, string) (ledger.NamedSession, error)
}

NamedSessionStore reads cross-run named LLM sessions.

type Options

type Options struct {
	Provider      ReadProvider
	Adapter       llm.Adapter
	Store         Store
	NamedSessions NamedSessionStore
	Layout        statepaths.Layout
	Warnings      io.Writer

	Now             func() time.Time
	NewRunID        func() string
	NewSessionRowID func() string
	NewFindingID    func() (review.FindingID, error)
	NewActionID     func(reviewplan.ActionKind) (string, error)

	Budget         ContextBudget
	MaxAgents      int
	MaxConcurrency int

	Retention           datalifecycle.RetentionPolicy
	RetentionManualOnly bool
}

Options contains dry-run pipeline dependencies.

type ParsedDiff

type ParsedDiff struct {
	PlanDiff reviewplan.Diff
	Patches  []FilePatch
}

ParsedDiff contains planner metadata plus whole-file patches.

type ReadProvider

ReadProvider is the PR read boundary needed by dry-run review.

type Request

type Request struct {
	PRRef           gitprovider.PRRef
	PRURL           string
	ProfileName     string
	SessionName     string
	Profile         config.Profile
	PostingIdentity gitprovider.Identity
	AgentDirs       []string

	SelectionModelOverride      string
	SelectionEffortOverride     string
	SelectionPromptInstructions string
	ReviewerModelOverride       string
	ReviewerModelTierOverride   string
	ReviewerEffortOverride      string
	ReviewBaseSHA               string
	ReviewHeadSHA               string

	FailOn              *review.Severity
	IncludeNits         bool
	AllowSelfReview     bool
	AllowSelfApprove    bool
	NoResolveThreads    bool
	MajorRequestChanges bool

	// ToolVersion is the raw cr version string rendered in the rollup
	// footer (e.g. "0.3.63").
	ToolVersion string
}

Request identifies one dry-run review.

type Result

type Result struct {
	Run                   ledger.Run
	PR                    gitprovider.PR
	PRKey                 string
	Artifacts             ArtifactPaths
	Quota                 llm.Quota
	QuotaSupported        bool
	QuotaLow              bool
	Catalog               agents.Catalog
	Selection             llm.Selection
	Findings              []review.Finding
	Rollup                review.Rollup
	Plan                  reviewplan.Plan
	Sessions              []ledger.Session
	PlannedActions        []ledger.PlannedAction
	NamedSessionCandidate *ledger.NamedSession
	FailOnTriggered       bool
	EffectiveCaps         reviewplan.ProviderCaps
	AgentDefsChanged      bool
	CurrentBaseSHA        string
	CurrentHeadSHA        string
	ReviewBaseSHA         string
	ReviewHeadSHA         string
}

Result is the completed dry-run pipeline output.

func DryRun

func DryRun(ctx context.Context, opts Options, req Request) (Result, error)

DryRun executes the dry-run review pipeline.

func Live

func Live(ctx context.Context, opts Options, req Request, run ledger.Run) (Result, error)

Live executes the review planning phases into a gate-allocated live run.

type SelectionRequest added in v0.3.67

type SelectionRequest struct {
	PRRef         gitprovider.PRRef
	ProfileName   string
	Profile       config.Profile
	AgentDirs     []string
	ArtifactDir   string
	ReviewBaseSHA string
	ReviewHeadSHA string

	SelectionModelOverride      string
	SelectionEffortOverride     string
	SelectionPromptInstructions string
}

SelectionRequest runs only the selection phase without review persistence or posting.

type SelectionResult added in v0.3.67

type SelectionResult struct {
	PR               gitprovider.PR
	PRKey            string
	Artifacts        ArtifactPaths
	Quota            llm.Quota
	QuotaSupported   bool
	QuotaLow         bool
	Catalog          agents.Catalog
	ParsedDiff       ParsedDiff
	ChangedFiles     []string
	Threads          []gitprovider.InlineThread
	Selection        llm.Selection
	SelectionSession SelectionSession
	EffectiveCaps    reviewplan.ProviderCaps
	AgentDefsChanged bool
	CurrentBaseSHA   string
	CurrentHeadSHA   string
	ReviewBaseSHA    string
	ReviewHeadSHA    string
}

SelectionResult is the selection-only pipeline output.

func SelectionOnly added in v0.3.67

func SelectionOnly(ctx context.Context, opts Options, req SelectionRequest) (SelectionResult, error)

SelectionOnly executes only the selection phase using caller-owned artifacts.

type SelectionSession added in v0.3.67

type SelectionSession struct {
	ProviderReportedSessionID string
	ProviderSessionID         string
	Adapter                   string
	Model                     string
	Effort                    string
	StartedAt                 time.Time
	CompletedAt               time.Time
	Response                  llm.Response
}

SelectionSession describes the single LLM turn used for selection-only execution.

type Store

type Store interface {
	ListRuns(context.Context) ([]ledger.Run, error)
	DeleteRun(context.Context, string) error
	AllocateRun(context.Context, ledger.AllocateRunParams) (ledger.Run, error)
	InsertSession(context.Context, ledger.Session) error
	InsertFinding(context.Context, ledger.Finding) error
	InsertPlannedAction(context.Context, ledger.PlannedAction) error
	CompleteRun(context.Context, string, ledger.Outcome, time.Time) error
}

Store is the ledger behavior required by the dry-run pipeline.

Jump to

Keyboard shortcuts

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