Documentation
¶
Overview ¶
Package review closes the loop around agent work: every completed agent task gets ONE review by a second agent, and a request_changes verdict can mint fix tasks. The reviewer only contributes findings — everything downstream (verdict bookkeeping, fix-task fan-out, dedup) is mechanical.
Loop safety is structural: reviews are never reviewed (the sweeper only reviews the "agent" type), each task is reviewed at most once (the review:<task-id> dedup key), and fix tasks minted from findings are bounded by the pool's budget guard, which counts every enqueue — reviews included — against the daily cap.
Index ¶
Constants ¶
const ( // ConsumerKey is the sweeper's identity in the watermarks table: the // persisted cursor shared by every sweeper over the same database, so // agent tasks completed while no sweeper was running still get their // review when the next pool starts. ConsumerKey = "review-sweeper" )
Variables ¶
This section is empty.
Functions ¶
func FixDedupKey ¶
FixDedupKey is the dedup identity of the fix task for one finding of one review: the same finding re-reported by the same review never spawns a second fix task.
func ReviewDedupKey ¶
ReviewDedupKey is the dedup identity of the review of one task: exactly one review per reviewed task, forever.
Types ¶
type SweepStats ¶
type SweepStats struct {
// Facts is the number of new facts consumed.
Facts int
// ReviewsEnqueued counts fresh review tasks this sweep created.
ReviewsEnqueued int
// ReviewsKnown counts completed agent tasks whose review task already
// existed (dedup hit — the review ran, or is pending, elsewhere).
ReviewsKnown int
// FixesEnqueued counts fresh fix tasks minted from findings.
FixesEnqueued int
// Skipped counts completions that could not yield a review (foreign
// payload shape, vanished task record).
Skipped int
}
SweepStats summarizes one sweep pass.
type Sweeper ¶
type Sweeper struct {
// contains filtered or unexported fields
}
Sweeper turns the journal's completion facts into review work. It is safe for concurrent use (the cursor serializes sweeps; ticks and the --once drain watcher may call it from different goroutines).
The struct shell deliberately stays per-sweeper (config fields and fact validation differ across the four sweepers); the shared pump is watermark.Cursor.Sweep.
art-dupl:accept mirrored sweeper shell: config fields and fact validation differ per sweeper; the shared pump already lives in watermark.Cursor.
func NewSweeper ¶
NewSweeper returns a sweeper over store. The cursor resumes from the persisted checkpoint — completions recorded while no sweeper was running are reviewed on the next start. A first run bootstraps at the journal head: completions that predate the sweeper are not replayed (same semantics as the papdashboard bridge; review the gap via `tq show`, or rewind with `tq watermarks set review-sweeper SEQ`).
func (*Sweeper) Sweep ¶
func (s *Sweeper) Sweep(ctx context.Context) (SweepStats, error)
Sweep consumes new facts since the last pass and enqueues review (and, with Autofix, fix) tasks. Idempotent by dedup: calling it twice never duplicates work, so a replayed page (crash between consumption and checkpoint) re-hits dedup keys instead of minting duplicates.
type SweeperConfig ¶
type SweeperConfig struct {
// Model, when set, is written into every review payload (and fix task).
Model string
// Autofix, when true, mints an agent fix task per finding of every
// request_changes review. Off by default: verdict-only mode is the safe
// first step; autofix closes the loop autonomously.
Autofix bool
// Log receives one summary line per sweep. nil logs nothing.
Log *slog.Logger
// PageSize bounds one fact-stream page; 0 selects the default.
PageSize int
}
SweeperConfig controls one Sweeper.