burnish

package
v0.21.0 Latest Latest
Warning

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

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

Documentation

Overview

Package burnish spawns a Smith worker to address PR review comments.

When Bellows detects "changes requested" on a PR, burnish fetches the review comments via the VCS provider, constructs a targeted fix prompt, and spawns Smith to address them. It then pushes the fixes to the PR branch.

Index

Constants

View Source
const DefaultVerifyTimeout = 5 * time.Minute

DefaultVerifyTimeout is the default deadline for the post-Smith verification (temper) step in a single burnish attempt. If temper does not return within this window the burnish worker logs WARN, marks the worker failed with a stable error string, and returns so the daemon can re-dispatch via its normal recovery path. Mirrored by config.SettingsConfig.BurnishVerifyTimeout for runtime override.

To reproduce the timeout in development, override the temper test step with a long-running command on the anvil's forge.yaml (e.g. `temper.steps: - { name: test, command: sleep, args: [999] }`) and trigger a burnish round. The burnish worker should emit "verification starting" then "WARN verification timeout after 5m0s (reason=warden_timeout)" in journalctl.

View Source
const ErrVerifyTimeoutReason = "warden_timeout"

ErrVerifyTimeoutReason is the stable error/event string emitted when burnish gives up waiting on verification. The bead retry path and operator dashboards match on this exact string, so do not change without coordinating.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchFixParams

type BatchFixParams struct {
	// WorktreePath is the git worktree for this PR's branch.
	WorktreePath string
	// BeadID for tracking.
	BeadID string
	// AnvilName for tracking.
	AnvilName string
	// AnvilPath is the repo root (used to populate FORGE_ANVIL_PATH in hook env).
	AnvilPath string
	// PRNumber being fixed.
	PRNumber int
	// Branch name for the PR.
	Branch string
	// DB for state tracking.
	DB *state.DB
	// WorkerID is the state DB worker ID.
	WorkerID string
	// ExtraFlags for Claude CLI.
	ExtraFlags []string
	// Providers is the ordered list of AI providers to try.
	Providers []provider.Provider
	// Comments is the list of review comments to address.
	Comments []vcs.ReviewComment
	// VCS is the VCS provider for thread resolution.
	VCS vcs.Provider
	// TemperConfig is the per-anvil temper configuration. Nil means auto-detect.
	TemperConfig *temper.Config
	// DetectOptions controls temper auto-detection behavior (e.g. golangci-lint).
	DetectOptions *temper.DetectOptions
	// GoRaceDetection enables Go race detection in temper steps.
	GoRaceDetection bool
	// Hooks is the per-anvil hook configuration for temper hooks.
	Hooks *config.HooksConfig
	// VerifyTimeout caps the post-Smith verification (temper) step.
	// When <= 0 the package default (DefaultVerifyTimeout) is applied.
	VerifyTimeout time.Duration
}

BatchFixParams holds the inputs for a batched review fix attempt.

type FixParams

type FixParams struct {
	// WorktreePath is the git worktree for this PR's branch.
	WorktreePath string
	// BeadID for tracking.
	BeadID string
	// AnvilName for tracking.
	AnvilName string
	// AnvilPath is the repo root.
	AnvilPath string
	// PRNumber being fixed.
	PRNumber int
	// Branch name for the PR.
	Branch string
	// DB for state tracking.
	DB *state.DB
	// WorkerID is the state DB worker ID, used to update the log path
	// so the Hearth TUI can display live activity.
	WorkerID string
	// MaxAttempts is the maximum fix attempts for review comments.
	MaxAttempts int
	// ExtraFlags for Claude CLI.
	ExtraFlags []string
	// Providers is the ordered list of AI providers to try.
	// If empty, provider.Defaults() is used (Claude → Gemini).
	Providers []provider.Provider
	// VCS is the VCS provider for repository operations. When set,
	// it is used for GetRepoOwnerAndName instead of creating a throwaway instance.
	VCS vcs.Provider
	// TemperConfig is the per-anvil temper configuration. Nil means auto-detect.
	TemperConfig *temper.Config
	// DetectOptions controls temper auto-detection behavior (e.g. golangci-lint).
	DetectOptions *temper.DetectOptions
	// GoRaceDetection enables Go race detection in temper steps.
	GoRaceDetection bool
	// Hooks is the per-anvil hook configuration. When set, before_temper and
	// after_temper hooks fire around every temper invocation.
	Hooks *config.HooksConfig
	// VerifyTimeout caps the post-Smith verification (temper) step per attempt.
	// When <= 0 the package default (DefaultVerifyTimeout) is applied.
	VerifyTimeout time.Duration
}

FixParams holds the inputs for a review fix attempt.

type FixResult

type FixResult struct {
	// Addressed is true if Smith successfully pushed review fixes.
	Addressed bool
	// Attempts is how many fix cycles were tried.
	Attempts int
	// CommentsFound is how many review comments were fetched.
	CommentsFound int
	// Duration is the total time spent.
	Duration time.Duration
	// Error if the fix process itself failed.
	Error error
}

FixResult captures the outcome of addressing review comments.

func BatchFix

func BatchFix(ctx context.Context, p BatchFixParams) *FixResult

BatchFix combines multiple review comments into one Smith prompt. Use this when copilot_batch_review_fixes is enabled and the provider is Copilot.

func Fix

func Fix(ctx context.Context, p FixParams) *FixResult

Fix fetches review comments and spawns Smith to address them.

Jump to

Keyboard shortcuts

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