Documentation
¶
Overview ¶
Package pipeline orchestrates review pipeline phases without owning command IO.
Index ¶
- Variables
- func Failure(kind FailureKind, err error) error
- func HasLLMTaskMetadata(artifactDir string) (bool, error)
- type ArtifactPaths
- type ContextBudget
- type FailureKind
- type FilePatch
- type LLMTaskProgress
- type LLMTaskProgressEvent
- type LLMTaskProgressResult
- type LLMTaskProgressSpan
- type NamedSessionStore
- type Options
- type ParsedDiff
- type ReadProvider
- type Request
- type Result
- type ReviewerFailure
- type SelectionRequest
- type SelectionResult
- type SelectionSession
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrStructuredOutputInvalidAfterRetry = llm.ErrStructuredOutputInvalidAfterRetry
ErrStructuredOutputInvalidAfterRetry marks a selector or rollup response that stayed invalid after the LLM retry path.
Functions ¶
func Failure ¶ added in v0.10.255
func Failure(kind FailureKind, err error) error
Failure marks err with a recovery class.
func HasLLMTaskMetadata ¶ added in v0.9.176
HasLLMTaskMetadata reports whether an artifact directory contains at least one completed task metadata file. Metadata is written last, so its presence is the durable boundary for safe task resume.
Types ¶
type ArtifactPaths ¶
type ArtifactPaths = runartifact.Paths
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.
type ContextBudget ¶
type ContextBudget struct {
MaxPromptBytes int
}
ContextBudget limits prompt size. A negative MaxPromptBytes disables checks.
type FailureKind ¶ added in v0.10.255
type FailureKind uint8
FailureKind describes whether a live planning failure can be resumed safely.
const ( // FailureTransient is an attempt-scoped failure that may succeed on retry. FailureTransient FailureKind = iota // FailureDurableBlocking preserves resumable task state. FailureDurableBlocking // FailureTerminal cannot be resumed safely. FailureTerminal )
func ClassifyFailure ¶ added in v0.10.255
func ClassifyFailure(err error) FailureKind
ClassifyFailure returns the recovery class for err.
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 LLMTaskProgress ¶ added in v0.9.178
type LLMTaskProgress = llmlifecycle.Progress
LLMTaskProgress records task-aware LLM pipeline breadcrumbs without owning command IO details.
type LLMTaskProgressEvent ¶ added in v0.9.178
type LLMTaskProgressEvent = llmlifecycle.ProgressEvent
LLMTaskProgressEvent describes one LLM task execution or reload.
type LLMTaskProgressResult ¶ added in v0.9.178
type LLMTaskProgressResult = llmlifecycle.ProgressResult
LLMTaskProgressResult describes the outcome of one task execution or reload.
type LLMTaskProgressSpan ¶ added in v0.9.178
type LLMTaskProgressSpan = llmlifecycle.ProgressSpan
LLMTaskProgressSpan is one active LLM task breadcrumb.
type NamedSessionStore ¶
type NamedSessionStore interface {
GetNamedSession(context.Context, string) (ledger.NamedSession, error)
UpsertNamedSession(context.Context, ledger.NamedSession) error
}
NamedSessionStore persists cross-run LLM sessions.
type Options ¶
type Options struct {
Provider ReadProvider
Adapter llm.Adapter
Store Store
NamedSessions NamedSessionStore
Layout statepaths.Layout
Warnings io.Writer
TaskProgress LLMTaskProgress
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
GitCommand func(context.Context, string, ...string) ([]byte, error)
ResolveRepoRoot func(context.Context) (string, error)
}
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 ¶
type ReadProvider interface {
GetPR(context.Context, gitprovider.PRRef) (gitprovider.PR, error)
GetDiff(context.Context, gitprovider.PRRef) (gitprovider.UnifiedDiff, error)
GetFileAtRef(context.Context, gitprovider.PRRef, string, string) ([]byte, error)
ListTreeAtRef(context.Context, gitprovider.PRRef, string, string) ([]gitprovider.TreeEntry, error)
ListInlineThreads(context.Context, gitprovider.PRRef) ([]gitprovider.InlineThread, error)
ListReviews(context.Context, gitprovider.PRRef) ([]gitprovider.Review, error)
ListIssueComments(context.Context, gitprovider.PRRef) ([]gitprovider.IssueComment, error)
Capabilities() gitprovider.ProviderCaps
}
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
ReviewerFast bool
ReviewBaseSHA string
ReviewHeadSHA string
Rerun bool
FreshSession bool
FailOn *review.Severity
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
ReviewerFailures []ReviewerFailure
ReviewerCoverage []reviewplan.ReviewerCoverageSummary
// contains filtered or unexported fields
}
Result is the completed dry-run pipeline output.
type ReviewerFailure ¶ added in v0.9.176
type ReviewerFailure struct {
TaskID string `json:"task_id"`
AgentID string `json:"agent_id"`
Error string `json:"error"`
}
ReviewerFailure records an isolated reviewer LLM task failure that should not abort the whole run.
type SelectionRequest ¶ added in v0.3.67
type SelectionRequest struct {
PRRef gitprovider.PRRef
ProfileName string
Profile config.Profile
PostingIdentity gitprovider.Identity
AgentDirs []string
ArtifactDir string
ReviewBaseSHA string
ReviewHeadSHA string
MaxAgents int
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)
ListRunsForHeadScope(context.Context, ledger.ListRunsForHeadScopeParams) ([]ledger.Run, error)
DeleteRun(context.Context, string) error
AllocateRun(context.Context, ledger.AllocateRunParams) (ledger.Run, error)
InsertSession(context.Context, ledger.Session) error
GetSession(context.Context, string) (ledger.Session, error)
InsertPlanningResult(context.Context, []ledger.Finding, []ledger.PlannedAction) error
ListFindings(context.Context, string) ([]ledger.Finding, error)
ListPlannedActions(context.Context, string) ([]ledger.PlannedAction, error)
CompleteRun(context.Context, string, ledger.Outcome, time.Time) error
}
Store is the ledger behavior required by the dry-run pipeline.