loop

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 80 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package loop is the implement loop's engine (itd-2609201916151817, spc-2609202134338445): the state file a run lives in, the checks that decide whether a run may start, and the step interface a driving host calls. `abcd build <itd-N>` starts a run; `abcd implement step` performs the next stage of the current lane and exits; `abcd implement receipt <path>` hands back what an agent stage waited on; `abcd implement status` renders the state. Nothing here holds a run in memory between invocations: every call reads the state file first, does at most one stage, writes the state file last and returns (decisions 1 and 2), so a killed process loses only the stage it was in, which the next call repeats.

The state lives in the checkout's local tier:

.abcd/.work.local/run/<run-id>/state.json   the run: its key, lanes, clock and record
.abcd/.work.local/run/.lock                 the advisory lock every mutation takes

The tier is never created here: only a repository abcd manages has it, which is what keeps a run managed-only without a check of its own to drift from (internal/core/mode draws the same line). The run directories beneath it are created one level at a time and proved real (fsutil.EnsureRealDirAll), and the state is written through the package's one atomic writer inside an os.Root, so a symlinked component is refused rather than followed.

The lane's stages are a sequence (Sequence), and each stage's body is a Handler the piece of the spec that delivers it registers in DefaultStages: the worktree (piece 6, lane.go), the brief (piece 5, brief.go), the implement stage and its receipt's verifier (piece 7, receipt.go), the validators (piece 8) and the landing (piece 9). A stage whose body this build does not carry is refused by name, with the piece that delivers it, and the run is left unchanged. A lane's files live in its own directory of the run:

.abcd/.work.local/run/<run-id>/<lane-id>/brief.md      the brief the loop renders
.abcd/.work.local/run/<run-id>/<lane-id>/receipt.json  the implementer's receipt

and its worktree in the machine-scoped store, ~/.abcd.noindex/worktrees/<root-sha>/<run-id>-<lane-id>. The process driver (piece 3, drive.go) is the same loop: Drive performs the next stage and, when it hands the lane to a role routed to a command-line runner (itd-2609201916056194), starts that agent through the runner and hands its receipt back through Receipt.

Core never writes to stdout; the CLI front door formats what these functions return.

Index

Constants

View Source
const (
	LensDesign = "design"
	LensRecord = "record"
)

The two lenses of the plan review, one fresh reviewer each (the adversarial-review principle's proven pair).

View Source
const (
	BriefFileName   = "brief.md"
	ReceiptFileName = "receipt.json"
	ReportFileName  = "report.md"
	DoDFileName     = "dod.log"
)

The files of a lane's directory, .abcd/.work.local/run/<run-id>/<lane-id>/. The loop writes the brief; the implementer writes the other three.

View Source
const (
	CheckKey           = "key"
	CheckReady         = "ready"
	CheckOpenQuestions = intent.StartCheckOpenQuestions
	CheckClaimSections = intent.StartCheckClaimSections
	CheckHold          = intent.StartCheckHold
	CheckBlocked       = intent.StartCheckBlocked
	CheckSteps         = intent.StartCheckSteps
	CheckPeers         = "peers"
	// CheckEligible is an issue key's row: the drained repository's own rule
	// takes the issue (itd-82 scope 2; decision 10 on the parent).
	CheckEligible = "eligible"
)

Check names, in the fixed order Check reports them.

View Source
const (
	MergeableConflicting = "CONFLICTING"
	MergeableUnknown     = "UNKNOWN"
)

The forge's mergeable verdicts.

View Source
const (
	// ControlFileName is the record, under the run's directory.
	ControlFileName = "control.json"

	// StageDriver is the refusal stage and the record's stage for the driver.
	StageDriver = "driver"
)
View Source
const (
	// DrainStoppedCap: the drain opened --max lanes.
	DrainStoppedCap = "cap"
	// DrainStoppedEmpty: no eligible issue is left that this drain has not
	// taken, held by another or not; with held work left the drain waits
	// (drain_wait.go).
	DrainStoppedEmpty = "empty"
)

Why a drain ended.

View Source
const (
	DrainLaneInProgress = "in-progress"
	// DrainLanePullRequest: the landing opened the lane's pull request and
	// armed it or left it open; the merge is a person's gate.
	DrainLanePullRequest = "pull-request"
	DrainLaneHandedBack  = "handed-back"
	// DrainLaneDone: the run is complete.
	DrainLaneDone = "done"
	// DrainLaneHalted is a lane a person's stop halted, which a drive passed over: it
	// waits for an explicit take-over, and the drain goes on to other work.
	DrainLaneHalted = "halted"
	// DrainLaneTakenOver is such a lane once a person has taken its run over: the run is
	// theirs to drive, and the drain leaves it to them.
	DrainLaneTakenOver = "taken-over"
)

The outcomes of a lane the drain opened, as the drain reads its run.

View Source
const (
	// RoutePromoted: a user moment, promoted to an intent draft with
	// `capture promote`; the issue gains the draft in related_intents and
	// nothing else is written.
	RoutePromoted = "promoted"
	// RouteDecisionRecord: a rule about trust or safety, flagged as needing a
	// decision record with the question stated, in the summary and as the
	// `decision_needed:` marker on the open issue (itd-82 decision 10), which
	// is the only write; nothing is minted.
	RouteDecisionRecord = "decision-record"
	// RouteRule: above the rule's severity, outside its categories, or held
	// by another of its rules; flagged naming the rule.
	RouteRule = "rule"
	// RouteHome: anything else, flagged with the home the decision belongs in.
	RouteHome = "home"
)

The routes a hand-back takes, by kind (scope 5).

View Source
const (
	ParkedWaiting     = "waiting"
	ParkedConflicting = "conflicting"
	ParkedClosed      = "closed"
	ParkedMerged      = "merged"
	ParkedUnread      = "unread"
	// ParkedSyncing: the pull request conflicts only on files origin's
	// default branch declares generated, or not at all as this checkout
	// merges, so the lane went back through its sync (step 13).
	ParkedSyncing = "syncing"
	// ParkedDropped: the armed pull request left the merge queue disarmed (a
	// failed merge-group check, named in the note), or its head moved under
	// it, or the loop's own toggle of its arming left it disarmed (the
	// refusal, naming the command that re-arms it, is the note), so it will
	// not merge on its own (iss-2610090642376032). It is still
	// renewed: a person re-arms it, and a release's hold, which withdraws
	// armed merges and re-arms them after, reads the same in the listing.
	ParkedDropped = "dropped"
	// ParkedStopHolds: a stop's mark stands on the run, so the move did nothing for it,
	// whatever its pull request says; the note says what takes it up.
	ParkedStopHolds = "stop-holds"
)

What a move read a parked lane's pull request as.

View Source
const (
	// DrainOriginFetch: the fetch from origin failed.
	DrainOriginFetch = "fetch"
	// DrainOriginDefaultBranch: the fetch could not read origin's default
	// branch (renamed since this checkout last knew it), or its commit could
	// not be resolved.
	DrainOriginDefaultBranch = "default-branch"
	// DrainOriginHead: this checkout names no default branch of origin (no
	// origin/HEAD, and no origin/main, master, trunk or develop).
	DrainOriginHead = "origin-head"
)

Why a drain move could not read origin: the kinds an origin wait records.

View Source
const (
	// DrainWaitCap: the drain's holder is at the cap of live reservations.
	DrainWaitCap = "cap"
	// DrainWaitHeld: every eligible issue left is held by another.
	DrainWaitHeld = "held"
)

The waits a drain makes, in waiting.

View Source
const (
	StageRunner   = "runner"
	StageFallback = "fallback"
)

StageRunner is the record's stage for a role a runner ran, and StageFallback for one a runner did not.

View Source
const (
	FindingApplied  = "applied"
	FindingRejected = "rejected"
	FindingUnknown  = "unknown"
)

The statuses a fix report gives a finding.

View Source
const (
	DrainJudgementRequestRel = RunRelDir + "/drain-judgement.request.md"
	DrainJudgementAnswerRel  = RunRelDir + "/drain-judgement.json"
)

DrainJudgementRequestRel is the request the drain writes for the host, and DrainJudgementAnswerRel where the host writes its answer. One judgement is awaited at a time, so each is one file beside the drain's state.

View Source
const (
	// JudgementYes: the remedy changes what a user sees or a trust boundary;
	// the issue is handed back.
	JudgementYes = "yes"
	// JudgementNo: it changes neither; the lane opens.
	JudgementNo = "no"
)

The answers to the one question.

View Source
const (
	// Remote is the remote a lane lands through: the one the default branch
	// is read from.
	Remote = "origin"
	// LandDirName is the lane's directory the landing writes into.
	LandDirName = "land"
	// PRBodyFileName is the pull request's body as the loop composed it, and
	// PRStrippedFileName the body re-read from the forge and stripped.
	PRBodyFileName     = "pr-body.md"
	PRStrippedFileName = "pr-body.stripped.md"
)

The landing's fixed names.

View Source
const (
	// SeriesStoppedCap: the series made --max picks.
	SeriesStoppedCap = "cap"
	// SeriesStoppedEmpty: no candidate is left.
	SeriesStoppedEmpty = "empty"
)

Why a series ended.

View Source
const (
	SeriesPickInProgress = "in-progress"
	// SeriesPickDelivered: the run is complete.
	SeriesPickDelivered = "delivered"
	// SeriesPickHandedBack: a lane of the run was handed back, so the lane
	// stopped; the run stays for the person.
	SeriesPickHandedBack = "handed-back"
	// SeriesPickRemoved: the run's directory was removed, the way out of a
	// handed-back run.
	SeriesPickRemoved = "removed"
)

What a series' pick has come to, as the series reads its run.

View Source
const (
	StageOutage        = "outage"
	DrainStoppedOutage = "outage"
)

StageOutage is the refusal stage of a run that gave up on an outage, and DrainStoppedOutage why a drain ended on one.

View Source
const (
	BundledWorkMinutes  = 120
	BundledPauseMinutes = 0
	BundledSubAgents    = 2
)

The bundled pace: 120 minutes of work, no pause, two lanes (decision 5, the product thinker's numbers for this repository's runs on 2026-09-20, with the pause removed by the product thinker's ruling of 2026-10-10). A repository that wants a pause writes its own under `pace` in its .abcd/config.json.

View Source
const (
	StageRateLimit  = "rate-limit"
	StageCheckpoint = "checkpoint"
)

StageRateLimit is the run record's stage for a rate-limit response, and StageCheckpoint for a lane it checkpointed.

View Source
const (
	HandBackUserVisible   = "user-visible"
	HandBackTrustRule     = "trust-rule"
	HandBackDesignFinding = "design-finding"
	HandBackSecondPackage = "second-package"
)

The kinds a lane hands an issue back as (itd-82: a reviewer's design finding, a second package, a user-visible change the remedy did not name, and a rule about trust or safety).

View Source
const (
	StageTranscript = "transcript"
	StageRecord     = "record"
)

StageTranscript is the run record's stage for a captured transcript, and StageRecord the refusal stage of the record's own verb.

View Source
const (
	StageReservationRenewed     = "reservation_renewed"
	StageReservationRenewFailed = "reservation_renew_failed"
	// StageReservationReleased is a step's release of an issue run's
	// reservation when its lane is handed back.
	StageReservationReleased = "reservation_released"
	// StageReservationReleaseFailed is a step's release of an issue run's
	// reservation that could not push the tombstone: the drain routing the
	// hand-back tries it again.
	StageReservationReleaseFailed = "reservation_release_failed"
)

The run record's stages for the run's reservation.

View Source
const (
	StageReservation = "reservation"
	CheckReservation = "reservation"
)

StageReservation is the refusal stage, and the run record's stage, of a run's start that reserves its key; CheckReservation is the check a drain names when it passes over an issue another holds.

View Source
const (
	AsideDirName   = "aside"
	AsideFileName  = "aside.json"
	AsidePatchName = "changes.patch"
)

The aside a restart saves, under the lane's directory of the run: <lane-dir>/aside/<UTC stamp>/.

View Source
const (
	WhyDied = "agent died"

	// NetworkLinePrefix opens the line an agent yielding on a network failure
	// hands back.
	NetworkLinePrefix = "NETWORK:"
)

The reasons a restart records.

View Source
const (
	ClassResearch = "research"
	ClassTop      = "top"
	ClassDefault  = "default"
	ClassSmall    = "small"
)

The model classes, strongest first, named for what each is for (itd-2611101419006280 decision 1): research, top, default and small. They renamed the scale of iss-2610140652230444's ruling of 2026-10-14 one for one (top, middle, below and smallest), and the old names are refused, never aliased, since the old top and the new top are different classes.

View Source
const (
	JudgeWaiting = "waiting"
	JudgeActive  = "active"
)

The statuses a judge is stored with.

View Source
const (
	StageRetry  = "retry"
	StagePaused = "paused"
)

StageRetry is the record's stage for a held role retried on its runner, and StagePaused for a role its runner failed to start.

View Source
const (
	HoldBeforePush = "push"
	HoldBeforeArm  = "arm"
)

The landing steps a hold stops before.

View Source
const (
	ModelAsked    = "asked"
	ModelReported = "reported"
	ModelUnsent   = "unsent"
)

The statuses of a reviewer's model.

View Source
const (
	ComparisonAgree    = "agree"
	ComparisonDisagree = "disagree"
	ComparisonNone     = "none"
)

The outcomes of a comparison.

View Source
const (
	BundledStuckRefusals = 3
	BundledStuckMinutes  = 60
)

The bundled stuck bounds (dcn-2610161040382067): three identical refusals, or sixty minutes refusing at one stage. A repository sets its own under `pace` in .abcd/config.json, a machine in ~/.abcd.noindex/config.json.

View Source
const (
	// TerminalStopped: a stop was asked for.
	TerminalStopped = "stop"
	// TerminalOutage: failures ran through the outage schedule to its limit.
	TerminalOutage = "runner-outage"
	// TerminalWall: a wall checked before a stage no longer held.
	TerminalWall = "wall"
	// TerminalRefused: a move refused in a way the run cannot go past.
	TerminalRefused = "refused"
	// TerminalHalted: a stop set from outside this terminal holds, or one a run
	// keeps stands against it (itd-2611041549471712). What the run holds is that
	// stop's to let go.
	TerminalHalted = "halted"
	// TerminalLimited: the account's rate limit outlasts what a drive waits.
	TerminalLimited = "rate-limited"
	// TerminalWaited: nothing moved for as long as a drive waits.
	TerminalWaited = "waited"
	// TerminalUntil: the bound the person set with --until has passed.
	TerminalUntil = "until"
	// TerminalKilled: the context ended, a second signal: the agent's process
	// group was killed, and what it held lapses on its own unless a load-gate
	// waiter in this copy renews it (gateWaiterRenews).
	TerminalKilled = "killed"
	// TerminalPassedLanes: the only lanes the drain has left in progress are ones the
	// drive passed over, since it may not save them (PassedLane): the drain stays open,
	// and a drive that may save them takes them up.
	TerminalPassedLanes = "passed-lanes"
)

Why a terminal run ended that the drain's own Stopped does not say.

View Source
const (
	UnattendedBuild = "build"
	UnattendedDrain = "drain"
)

The kinds of unattended work.

View Source
const (
	RoleRuthless = "ruthless-reviewer"
	RoleSecurity = "security-reviewer"
	RoleAuditor  = "intent-auditor"
)

The validators, by the agent definition each is started as.

View Source
const (
	ValidateDirName      = "validate"
	FixDirName           = "fix"
	ReturnFileName       = "return.md"
	VerdictFileName      = "verdict.json"
	AuditRequestFileName = "request.md"
)

The files of a validation round.

View Source
const AcceptConfigFlag = "--accept-config-change"

AcceptConfigFlag is the `implement step` flag that accepts a changed configuration once the person has looked at it.

View Source
const BranchPrefix = "build/"

BranchPrefix is the namespace every lane branch is cut under.

View Source
const BundledBundleMax = 1

BundledBundleMax is the most issues one drain lane takes when nothing sets drain.bundle_max: 1, so a drain bundles only where a person sets the key, until the split and the drain's figures exist (decision 12).

View Source
const BundledEffort = "high"

BundledEffort is every class's effort when the machine names none.

View Source
const BundledFixRounds = 3

BundledFixRounds is the fix rounds a lane may take before it is handed back when nothing sets it (ruling DR1 of 2026-09-29: "tied to the pace settings, a per-run value set alongside --pace, default 3"; itd-50 decision 2).

View Source
const BundledJudge = ClassTop

BundledJudge is the bundled judge's class: the class between the pair. It runs only once a judge agent has cleared itd-81's calibration gate, and until then a run starts with it waiting (decision 5).

View Source
const (
	BundledMaxReviewers = 2
)

BundledMaxReviewers is the ceiling on reviewers per role when the machine sets none, and maxReviewers the most any ceiling may be.

View Source
const CheckBudget = "budget"

CheckBudget is the budget check's row among the start's checks, and the run record's stage for it.

View Source
const CheckFootprint = "footprint"

CheckFootprint is the exclusion of a planned intent whose spec names no footprint packages to reserve it with, or names one by prose rather than by its path, in a checkout with a remote named origin: its start would be refused at the reservation.

View Source
const CheckLapsed = "lapsed"

CheckLapsed is the pass-over of an issue whose judgement request lapsed unanswered, while its cool-down runs.

View Source
const CheckNeedsPerson = "needs-a-person"

CheckNeedsPerson is the pass-over of an issue a drive may not work.

View Source
const CheckOverlap = "overlap"

CheckOverlap is the exclusion of a planned intent whose start-time footprint shares a path with another copy's live reservation of another record, as this checkout last fetched them: its start would be refused at the reservation (iss-2611182334466021).

View Source
const CheckRun = "run"

CheckRun is the exclusion of a planned intent this checkout already has a run in progress for: the pick starts a run, never resumes one.

View Source
const CheckSeries = "series"

CheckSeries is the exclusion of a planned intent the series in progress has already picked: a series picks each intent once, whatever its run came to.

View Source
const CheckSkipped = "skipped"

CheckSkipped is the pass-over of an issue the drain's skip list holds back.

View Source
const ConfigFingerprintFileName = "config-fingerprint.json"

ConfigFingerprintFileName is the tripwire's file, beside the run's state.

View Source
const ConventionsFile = "AGENTS.md"

ConventionsFile is the file a brief's conventions are read from.

View Source
const DrainFromJudgement = "judgement"

DrainFromJudgement marks a hand-back the host judgement made, in a DrainRoute's From.

View Source
const DrainFromReservation = "reservation"

DrainFromReservation is a hand-back's From when the drain could not reserve the issue: its found_at names no path to reserve it with.

View Source
const DrainJudgementSchemaVersion = 1

DrainJudgementSchemaVersion is the answer's shape.

View Source
const DrainSchemaVersion = 4

DrainSchemaVersion is the drain state's shape.

Version 2 added a route's pins and override to a routed judge's stored route: a judgement's route carries the pin and sealed configuration's SHA-256 of a pinned opencode run (`provider_pin`, `pin_config_sha256`), a route to a model on this machine its local pin, what its server reported and that it is local (`local_pin`, `local_served`, `local`), and the route record's `override`, as the run state's version 16 does. The field comes with the route record the two share; no drain flag sets it. Version 1 is its strict subset, read as a drain whose judge was pointed at no pin and carries no override, and written back at version 2; a file of version 1 carrying any of them is not one its version wrote, and is refused naming the key. v0.15.1 reads no version first, so it refuses a version-2 file as one that does not parse; releases after it that write version 1 refuse it as a newer abcd's before any strict decode.

Version 3 added a judge fallback receipt's `spent`, as the run state's version 19 does (iss-2611021751406429): what a judge's launch killed past its time spent. Versions 1 and 2 are its strict subsets, read as a drain no killed judge fell back from, and written back at version 3; a file of version 2 or lower carrying it is refused naming it. Releases that write version 2 refuse a version-3 file as a newer abcd's before any strict decode.

Version 4 is a drain that bundles issues (itd-2611201450052326), defined whole at once so no later step raises it again: the drain's `bundle_max`, the cap it started with, with its layer and origin; a lane's `bundle`, the members it took, and `split`, a bundle the drain split; the drain's `forming`, the bundle its moves are forming; and a lane's `ci_minutes`, the time its pull request's checks ran. Each is written only by the step that uses it. Version 3 and lower are its strict subsets, read as a drain that started with the bundled cap, its layer recorded as `bundled`, and opened no bundle, and written back at version 4; a file of version 3 or lower carrying any of them is refused naming it. Releases that write version 3 refuse a version-4 file as a newer abcd's before any strict decode.

View Source
const DrainStateRel = RunRelDir + "/drain.json"

DrainStateRel is the drain's state file, beside the runs. Its name is not a run id, so the run listing never reads it as one.

View Source
const DrainStoppedOrigin = "origin"

DrainStoppedOrigin is why a drain ended that waited on origin through the outage schedule's hourly stage and gave up.

View Source
const FindingStruck = "struck"

FindingStruck is the status of a finding the round's judge struck.

View Source
const HandBackClosed = claim.HandBackClosed

HandBackClosed is the kind a parked lane whose pull request was closed unmerged is handed back as; a lane's receipt cannot name it.

View Source
const HandBackNotPlanned = "not-planned"

HandBackNotPlanned is the verdict an auto-plan lane is handed back with: the substitute did not hold, so the draft is the person's to plan.

View Source
const HandBackStuck = claim.HandBackStuck

HandBackStuck is the kind a stuck lane is handed back as; a lane's receipt cannot name it.

View Source
const HeldBackRel = ".abcd/.work.local/logs/drive-held-back.log"

HeldBackRel is the file that keeps what a drive held back.

View Source
const JudgeDirName = "judge"

JudgeDirName is the judge's directory in a round.

View Source
const NextSeriesRel = RunRelDir + "/next.json"

NextSeriesRel is the series' state file, beside the runs. Its name is not a run id, so the run listing never reads it as one.

View Source
const NextSeriesSchemaVersion = 1

NextSeriesSchemaVersion is the series state's shape.

View Source
const PlanReviewDirName = "plan-review"

PlanReviewDirName is the lane's directory of plan reviews.

View Source
const QueueStateQuery = `` /* 340-byte string literal not displayed */

QueueStateQuery is the forge's GraphQL query for an armed pull request's place in the merge queue: `gh pr view --json` has no merge-queue field, so it is read through the forge's API, as `abcd land` reads it. It reads the node id the enqueue call names, the head (the queue and a re-arm are pinned to it), whether it is queued, the arming and its age, the merge state, and the last removal from the queue with the forge's reason. Every field is pinned in internal/ghcontract.

View Source
const ReceiptSchemaVersion = 1

ReceiptSchemaVersion is the receipt's shape.

View Source
const ReviewRequestFileName = "request.md"

ReviewRequestFileName is the request a reviewer route is sent, beside the reviewer's brief.

View Source
const ReviewerModelPrefix = "Reviewer model:"

ReviewerModelPrefix opens the line a reviewer's return names the model it ran on with.

View Source
const RoleDrainJudge = "drain-judge"

RoleDrainJudge is the drain's judge, the role roles.drain-judge.runner routes.

View Source
const RoleImplementer = "implementer"

RoleImplementer is the agent the implement stage hands a lane to.

View Source
const RoleJudge = "review-judge"

RoleJudge is the role a review set's judge is handed out as.

View Source
const RunIDFamily = "run"

RunIDFamily is the run id's prefix; the id is minted through the record-id seam (adr-45), so two checkouts starting runs in one second draw distinct ids.

View Source
const RunRelDir = TierRelDir + "/run"

RunRelDir is the directory every run of this checkout lives under.

View Source
const SchemaVersion = 31

SchemaVersion is the state file's shape. A file carrying a version this build does not know is refused rather than read as this one: a field a later build added and this one would drop on its next write is a run silently losing state.

Version 2 added the run's pace (itd-2609201925079472). Version 1 is its strict subset, so a version-1 file is read as a run started before the loop paced a run: it carries no pace, runs unpaced, and is written back at version 2 by its next mutation. A version-1 file carrying a pace is not one version 1 wrote, and is refused.

Version 3 added the pick `abcd build next` made (itd-2609211116005482): the run's `pick` and a lane's `pick_sha`. Versions 1 and 2 are its strict subsets, read as runs no pick started and written back at version 3; one of them carrying a pick is not one its version wrote, and is refused.

Version 4 renamed the lane's stage (BU1, iss-2609291313276243): a lane's and a record line's `step` became `stage`, so the word "step" names only the spec's steps. Versions 1 to 3 wrote `step`, and are migrated on read: the read carries each `step` over to `stage` and writes nothing, and the run's next mutation writes the file back at version 4, as it does for the versions before. One of them that already says `stage` is not one its version wrote, and is refused.

Version 5 added the validate stage's record (spc-2609202134338445 piece 8): a lane's `validation`, its rounds and the verdicts the loop recorded. Version 4 is its strict subset, read as a run no validator has judged yet and written back at version 5; a version-4 file carrying a validation is not one version 4 wrote, and is refused.

Version 6 added the fix-round cap (ruling DR1, 2026-09-29): the pace's `fix_rounds`, and a lane's `hand_back` when it takes its cap of fix rounds without passing. Version 5 is its strict subset, read as a run started before the pace carried the cap, which runs on the bundled one, and written back at version 6; a version-5 file carrying either is not one version 5 wrote, and is refused.

Version 7 added the landing and the run record's transcripts (spc-2609202134338445 pieces 9 and 10): a lane's `landing`, the captures its receipts declared fixed (`resolves`) and the receipts it verified (`receipts`, each with the model its runner reported), and the run's `transcripts`. Version 6 is its strict subset, read as a run nothing has landed yet and written back at version 7; a version-6 file carrying any of them is not one version 6 wrote, and is refused.

Version 8 added the runner's record (itd-2609201916056194, spc-2609202134338445 piece 3): the run's `fallbacks`, one receipt per role a runner did not run, and the `route` a verified receipt or a validator's return names when a runner, not the host, ran its agent. Version 7 is its strict subset, read as a run the host ran every agent of and written back at the current version; a version-7 file carrying either is not one version 7 wrote, and is refused.

Version 9 made a run work in parallel up to its ceiling (ruling DR6, spc-2609202134341288): a lane's `awaits`, a list replacing the one `awaiting`, the run's `waiting`, a lane's `syncs` and `hold`, a pending step's `needs`, and the lane stages `held` and `discarded`. A file of version 8 or lower reads as a run whose lanes each await zero or one agent (its `awaiting` becomes a one-entry `awaits`) and is written back at version 9; a landing's `check_wait_since` (ruling DR6d-2) is version 9's too, added before any release wrote the version; one of them carrying anything only version 9 writes is refused, and so is a file of version 9 or later carrying `awaiting`, which no version since 8 writes.

Version 10 added an await's `kept` (iss-2610100913086397): why a rate-limit checkpoint kept the await when it could not save the gone agent's return aside, which `--restart` re-tells. Version 9 is its strict subset, read as a run no rate limit kept an await of and written back at version 10; a file of version 9 or lower carrying `kept` is not one its version wrote, and is refused. Releases that write version 9 (up to v0.13.4) decode a newer file strictly before they check its version: a version-10 file carrying `kept` reaches them as a file that does not parse, with a remedy to restore it or remove the run directory, and one without `kept` as a version they do not know.

Version 11 added the run's reservation on the shared remote (itd-2609091034175565, spc-2610031753359849 spec 2): the run's `reserved_at`, which `implement step` renews, fences and tombstones. Version 10 is its strict subset, read as a run that holds no reservation and written back at the current version; a file of version 10 or lower carrying `reserved_at` is not one its version wrote, and is refused.

Version 12 added an await's `answered` (itd-6): the reviewer route and the SHA-256 of the answer its step placed at the await's return path, under the run's lock, so the receipt records the review as the route's when the return its verifier reads is that answer. Version 11 is its strict subset, read as a run no route placed an answer for, its `reserved_at` kept, and written back at version 12; a file of version 11 or lower carrying `answered` is not one its version wrote, and is refused. Releases that write version 10 (v0.14.0 and v0.14.1), and builds that write version 11, decode a newer file strictly before they check its version: a version-12 file carrying `answered` or `reserved_at` reaches them as a file that does not parse (`unknown field`), with a remedy to restore it or remove the run directory, which would throw the run away; the run is intact, and the newer abcd that wrote it reads it. A version-12 file carrying neither reaches them as a version they do not know. From version 12 on, decodeState refuses a version above its own before any strict decode, so whatever a later version adds is read as a newer abcd's file, never as one that does not parse.

Version 13 added a lane's `refused` (spc-2610161044461448 step 5): an issue run's lane logs its run of refused steps, which a drain reads to hand a stuck lane back. Version 12 is its strict subset, read as a run whose lanes have refused nothing and written back at the current version; a file of version 12 or lower carrying `refused` is not one its version wrote, and is refused. Releases that write version 12 refuse a version-13 file as a newer abcd's.

Version 14 added both sides of a run (itd-166): a runner's route record on a verified receipt or a validator's return carries the model the runner asked for, the prompt's hash, the served models, provider, finish reason and harness version the harness reported, the token counts and cost, and the fields it could not pin (runner.Sides). Version 13 is its strict subset, read as a run whose routes recorded neither side, its lanes' `refused` kept, and written back at the current version; a file of version 13 or lower carrying either side is not one its version wrote, and is refused. Releases that write version 13 (v0.15.1) refuse a version-14 file as a newer abcd's before any strict decode.

Version 15 added the run's review set (itd-2610240922461281, spc-2610240951109420 step 1): the run's `review`, each role's reviewers at their model classes, the judge and the ceiling, with the layer of each. Version 14 is its strict subset, read as a run started before review sets, which carries none, and written back at the current version; a file of version 14 or lower carrying `review` is not one its version wrote, and is refused. Releases that write version 14 refuse a version-15 file as a newer abcd's.

Version 16 added a route's pins: a pinned opencode run's route carries its pin and the SHA-256 of the sealed configuration that held it (`provider_pin`, `pin_config_sha256`, iss-2610161734413178), and a route to a model on this machine its local pin, what its server reported and that it is local (`local_pin`, `local_served`, `local`, iss-2610161734428291). Version 15 is its strict subset, read as a run whose routes were pointed at no pin, its review set kept, and written back at version 16; a file of version 14 or 15 carrying any of them is not one its version wrote, and is refused naming the key, and one of version 13 or lower carrying any of them is refused with the sides it carries. Releases that write version 15 refuse a version-16 file as a newer abcd's before any strict decode. A route record's `override` (iss-2610161801358637), the `implement step --route` text verbatim on the verified receipt or the validator's return a runner ran under it, is version 16's too: it joined version 16 before any release wrote that version, so a file of version 15 or lower carrying it is not one its version wrote, and is refused naming the key. So is a validation round's `routes` (spc-2609251028149555, AC 10): the tier each role of the round ran at, the tier a failed round moved it up from, and the failing gate output that caused the switch.

Version 17 added a lane's `auto_plan` (spc-2609202134338445 step 11, adr-2610310235000654): the `abcd build --auto-plan` lane's draft and its digest, its two plan reviews with the verdicts the loop recorded, and the planned record and spec, beside the stages `plan-review` and `plan`. Version 16 is its strict subset, read as a run with no auto-plan lane and written back at version 17; a file of version 16 or lower carrying `auto_plan` is not one its version wrote, and is refused naming it. Releases that write version 16 refuse a version-17 file as a newer abcd's before any strict decode.

Version 18 added an await's `paused` and `running` (iss-2611012047534449, dcn-2611012113432054): why a role waits for the runner that failed to start it, rather than being handed to the host, and the runner a step started for it, claimed so no second step starts another. Version 17 is its strict subset, read as a run no runner paused and none holds, and written back at version 18; a file of version 17 or lower carrying either is not one its version wrote, and is refused naming it. Releases that write version 17 refuse a version-18 file as a newer abcd's before any strict decode.

Version 19 added a fallback receipt's `spent` (iss-2611021751406429): what a launch killed past its time or with its step spent, read from its transcript, or the agent run it is charged when that shows no cost. Version 18 is its strict subset, read as a run no killed launch fell back from, and written back at version 19; a file of version 18 or lower carrying it is not one its version wrote, and is refused naming it. Releases that write version 18 refuse a version-19 file as a newer abcd's before any strict decode.

Version 20 keyed a round by reviewer (itd-2610240922461281, spc-2610240951109420 step 3): a validator's `reviewer` index among its role's reviewers, the `class` the run's review set asked it for, the `model` the class resolved to and its `model_status` (asked, reported by the runner that ran it, or unsent when the reviewer route answered); an await's `reviewer`, `class` and `model`; and a round's `comparisons`, how each role's reviewers compared once all of them returned. Version 19 is its strict subset, read as a run whose rounds each ran one reviewer per role: that reviewer is index 0, at the path index 0 still takes, and asked for no class. It is written back at version 20; a file of version 19 or lower carrying any of them is not one its version wrote, and is refused naming it. Releases that write version 19 refuse a version-20 file as a newer abcd's before any strict decode.

Version 21 kept what a round was shown and how long a gate went unread: a round's `resolves_shown` and a landing's `gate_unread_since`. Version 20 is its strict subset, read as a run whose rounds were shown nothing, so a records commit from one goes to a person; a file of version 20 or lower carrying either is not one its version wrote, and is refused naming it. Releases that write version 20 refuse a version-21 file as a newer abcd's before any strict decode.

Version 22 kept the profile a drive runs the run on: the run's `profile`. Version 21 is its strict subset, read as a run no drive named one for; a file of version 21 or lower carrying one is not one its version wrote, and is refused naming it. Releases that write version 21 refuse a version-22 file as a newer abcd's before any strict decode.

Version 23 added a landing's `spec_settled`: the first step took an uncommitted change to the lane's own spec record, which its records commit carries. Version 22 is its strict subset, read as a landing that took none; a file of version 22 or lower carrying it is not one its version wrote, and is refused naming it. Releases that write version 22 refuse a version-23 file as a newer abcd's before any strict decode.

Version 24 kept each reviewer's located findings (itd-2610240922461281, spc-2610240951109420 step 4): a validator's `located` count and its `findings`, each a file and line with the fix report's `status` and the reviewers of the round citing it (`cited_by`). Version 23 is its strict subset, read as a run whose verdicts were recorded with no findings read; a file of version 23 or lower carrying them is not one its version wrote, and is refused naming them. Releases that write version 23 refuse a version-24 file as a newer abcd's before any strict decode.

Version 25 renamed the model classes for what each is for (itd-2611101419006280, spc-2611101423523725): a stored class label is one of research, top, default and small, where version 24 and earlier stored top, middle, below and smallest for the same classes; and a stored judge carries its `status`, waiting or active, fixed when the run started. A file of version 24 or lower is migrated on read: each label takes its new name (renamedClasses), each reviewer keeps the model it was resolved to, and a stored judge, which those versions kept only once its calibration had cleared, is active. Such a file carrying a label outside the four old names, or a judge's status, is not one its version wrote, and is refused. Releases that write version 24 refuse a version-25 file as a newer abcd's before any strict decode.

Version 26 added the run's `admitted` (itd-2610301850454860): the rule its lanes were admitted under, which each records commit carries as its `Admitted-by:` trailer. Version 25 is its strict subset, read as a run that recorded no admission, whose records step is refused naming the field; a file of version 25 or lower carrying one is not one its version wrote, and is refused naming it. Releases that write version 25 refuse a version-26 file as a newer abcd's before any strict decode.

Version 27 added the writers' and the reviewer's models (itd-2610301750162657, spc-2610301925429250 step 4): a reviewer's `writer_models`, every model that wrote into the lane up to the round, in the order they wrote; `reviewer_model`, the model it was asked for, or the one its runner reported once it returned; `reviewer_named`, the model its return named where that is not the same model; and `models_unrecorded`, set when a file of an earlier version is read on a reviewer it had already handed out. The review set gained `classes`, the whole class map the run started on, from which a reviewer whose class holds a writer's model takes another, and `unlaunchable`, the classes a drive's runners could not launch for each role when the run started. A receipt record gained `named`, the model its receipt named before the landing replaced it, and a lane `writers_launched`, each model a runner was started on for a role that writes into it. Version 26 is its strict subset, read as a run whose reviewers were dispatched before the comparison, and written back at version 27; a file of version 26 or lower carrying any of them is not one its version wrote, and is refused naming it. Releases that write version 26 refuse a version-27 file as a newer abcd's before any strict decode, and leave the run to the abcd that wrote it.

Version 28 added the review set's judge (itd-2610240922461281, spc-2610240951109420 step 5): a round's `judge`, the roles whose reviewers disagreed, the class, model and effort the run's active judge resolved to, its brief and return, whether it `ruled` and how many locations it `struck`, or why it was `unlaunched`; and a finding's `struck` status with the judge's `reason`. Version 27 is its strict subset, read as a run no judge ruled in, and written back at version 28; a file of version 27 or lower carrying either is not one its version wrote, and is refused naming it. Releases that write version 27 refuse a version-28 file as a newer abcd's before any strict decode.

Version 29 kept each location a round's judge struck, with its reason, on the judge (iss-2611182238519860): a round's judge's `strikes`, which outlive the round's findings once the next round opens. Version 28 is its strict subset, read as a run whose judges kept no strike, and written back at version 29: a ruled judge whose round still keeps its findings takes its strikes from them as the file is read, and one whose round's findings were dropped keeps its count alone. A file of version 28 or lower carrying a judge's strikes is not one its version wrote, and is refused naming them. Releases that write version 28 refuse a version-29 file as a newer abcd's before any strict decode.

Version 30 let a run carry members (itd-2611201450052326, spc-2611201455051897 step 1): an issue run's `bundle`, each member issue beside the lead with its footprint, its `reserved_at`, its `hand_back` once it is handed back alone and `split` once the drain has split the run; the run's `lead_hand_back`, the lead's own hand-back while its members go on; and a record line's `issue`, the issue a reservation line is for, written only in a run with members. A run with no members writes none of them, so its file differs from version 29's only in its version. Version 29 is its strict subset, read as a run with no members and written back at version 30; a file of version 29 or lower carrying any of them is not one its version wrote, and is refused naming it. Releases that write version 29 refuse a version-30 file as a newer abcd's before any strict decode.

Version 31 kept the digest of each validator's return as the loop read it when it recorded the verdict: a validator's `return_sha256`, which the landing holds every later read of that return to (recordedReturn). Version 30 is its strict subset, read as a run whose verdicts were recorded with no digest, whose returns the landing reads as they stand, and written back at version 31; a file of version 30 or lower carrying a digest is not one its version wrote, and is refused naming it. Releases that write version 30 refuse a version-31 file as a newer abcd's before any strict decode.

A version raises when the abcd driving the run writes it. A lane's own abcd may be a version ahead of its driver, and what it saves leaves the version where it was (mutateReservation, iss-2611020719494343).

View Source
const StageAdmitted = "admitted"

StageAdmitted is the run record's stage for the rule the run's lanes were admitted under.

View Source
const StageClaim = "claim"

StageClaim is the refusal stage of a start whose shared-run claim is refused for a reason of the caller's own (a session that has not joined, a bound).

View Source
const StageConfig = "config"

StageConfig is the refusal stage of a step the run tripwire stopped.

View Source
const StageDrain = "drain"

StageDrain is the refusal stage of the drain run.

View Source
const StageDriveReleaseFailed = "drive_release_failed"

StageDriveReleaseFailed is the run record's stage for a release that did not reach origin: its note is the tip it left and nothing else.

View Source
const StageDriveReleased = "drive_released"

StageDriveReleased is the run record's stage for a reservation a drive let go as it ended, which the drive that takes the lane up reserves again.

View Source
const StageKilled = "killed"

StageKilled is the record's stage for a role killed after its work stood: the lane is kept at its stage for its receipt, not paused.

View Source
const StagePace = "pace"

StagePace is the refusal stage of a pace or ceiling the loop cannot run on.

View Source
const StagePick = "pick"

StagePick is the refusal stage of a pick that takes nothing.

View Source
const StageProfile = "profile"

StageProfile is the run record's stage for a drive marking a run that named no profile with its own.

View Source
const StageRefused = "refused"

StageRefused is the run record's stage for a lane's refused step.

View Source
const StageReleasedOver = "drive_released_over"

StageReleasedOver is the run record's stage for the record a drive's release let go of: its note is that record's blob on origin's default branch and nothing else, so the take-up can tell what the issue asks now from what the lane was working to.

View Source
const StageReservationLost = "reservation_lost"

StageReservationLost is the run record's stage for a reservation the view shows held by another person or copy.

View Source
const StageResume = "resume"

StageResume is the refusal stage and the run record's stage for a take-over.

View Source
const StageReview = "review"

StageReview is the refusal stage of the reviewer route.

View Source
const StageRoute = "route"

StageRoute is the record's stage for a --route the step did not use.

View Source
const StageRouting = "routing"

StageRouting is the refusal stage of a routing table or provider configuration the step cannot read.

View Source
const StageStop = "stop"

StageStop is the refusal stage and the run record's stage for a stop.

View Source
const StageTrial = "trial"

StageTrial is the run record's stage for the line a trial run's start writes.

View Source
const StageUnpaused = "unpaused"

StageUnpaused is the record's stage for a paused role the person has since routed to the host: the pause is cleared and the host's agent takes it.

View Source
const StageWidenedTo = "reservation_widened_to"

StageWidenedTo is the run record's stage for a path a lane's reservation was widened to; its note is the path and nothing else. A reservation made again names these beside the found_at (widenedPaths), so they outlive a deleted tip.

View Source
const StateFileName = "state.json"

StateFileName is the name of a run's state file inside its directory.

View Source
const SyncDirName = "sync"

SyncDirName is the lane's directory a sync's brief and receipt live in.

View Source
const TerminalResumeCommand = "abcd drain --drive"

TerminalResumeCommand resumes a run that left a lane.

View Source
const TerminalWaitFloor = 30 * time.Second

TerminalWaitFloor is the shortest wait the terminal loop makes: no wait a move names, and no retry, comes sooner.

View Source
const TierRelDir = landing.TierRelDir

TierRelDir is the local-ephemeral tier the run state lives in, the tier the preflight's receipts live in too (landing.TierRelDir). It is never created here.

View Source
const UnlessRunRenewed = "unless a step or `abcd drain` run in this copy, or a load-gate waiter in this copy, renews it"

UnlessRunRenewed is the clause a lapse says of a live reservation this copy's last push takes and a lane's run still in progress holds: a step or `abcd drain` run in this copy renews it (advanceWith; renewInProgress, or for a lane parked at its pull request renewParkedDue), as a load-gate waiter does. `abcd implement status` is not named: its renewal (RenewRunsIn) passes over a lane parked at its pull request (renewsWhereItWaits), and a lane named here may be one. A run handed back, stopped or let go keeps unlessWaiterRenews.

View Source
const VerdictCellFailed = "cell-failed"

VerdictCellFailed is the verdict a trial's lane is handed back with when the runner of the cell under test failed, refused or answered unparsably: the cell's failure, scored as such and run nowhere else.

View Source
const VerdictUnachievable = "unachievable"

VerdictUnachievable is the verdict a lane is handed back with: the run's fix rounds could not bring it to a passing round (itd-50's UNACHIEVABLE).

Variables

View Source
var BundledClasses = map[string]string{
	ClassResearch: "anthropic/claude-fable-5",
	ClassTop:      "anthropic/claude-opus-5-5",
	ClassDefault:  "anthropic/claude-sonnet-5-5",
	ClassSmall:    "anthropic/claude-haiku-4-5",
}

BundledClasses is the bundled class map: one vendor's models, a default and not part of the rule (decision 3). For that vendor today the classes are Fable, Opus, Sonnet and Haiku (iss-2610140652230444).

View Source
var BundledReviewers = []string{ClassResearch, ClassDefault}

BundledReviewers is the bundled list each role runs: the research class and the default class, the widest spread between two reviewers (itd-2611101419006280 decision 4, reversing the top and default pair of itd-2610240922461281 decision 1).

Classes are the class names the class map carries, strongest first.

View Source
var DriveGates = []string{"Makefile", "GNUmakefile", "makefile", "scripts/", ".githooks/", "hooks/", ".github/",
	".abcd/rules.json", ".abcd/guard.json", ".abcd/config.json", ".abcd/config/",
	".abcd/.work.local/preflight-receipts/", ".abcd/.work.local/approvals/", ".abcd/.work.local/review-receipts/",
	".abcd/.work.local/reservation/"}

DriveGates are what a lane's preflight, the driver's own git and the forge's workflows run, and abcd's own configuration, receipts and approvals, as paths: a change to one is a change to what judges the lane. They are kept in this one place for everything that names them: `abcd drain --drive`, which lands no lane that changes one and passes over an issue on one; and the issue brief, which names them to the implementer. A directory ends in a slash. The files under .abcd are the ones a drive's stage may not write either.

View Source
var EffortLevels = runner.EffortLevels

EffortLevels are the levels models.effort takes, lowest first: the five the harness takes (decision 6), the runner's own list, which refuses a request at any other.

View Source
var LaneOpened func()

LaneOpened, when set, is called once the worktree stage has made a lane's worktree, for a build's lane and a drain's alike, and not when it adopts one it made before. The front door sets it to ask for the Go build cache's trim, since a lane is what fills the cache, and it must return at once: it runs in the stage, under the run's lock. Nil calls nothing, so the loop's own tests start no trim.

View Source
var PlanSequence = []Stage{StagePlanReview, StagePlan}

PlanSequence is an auto-plan lane's stages (autoplan.go): its two plan reviews, then the plan.

Sequence is the lane's stages in the order the loop performs them: make the lane's worktree, render its brief, hand it to an implementer and take the receipt, run the validators, land it. A lane past its last stage is StageDone.

Functions

func AcceptConfigChange added in v0.14.0

func AcceptConfigChange(repoRoot, runID string, o Options) ([]string, error)

AcceptConfigChange re-records the run's fingerprint from the repository as it stands, on the person's word once they have looked at what changed (`abcd implement step --accept-config-change`), and names in the run record each key or file it accepted. It returns those names; nothing changed (or a run with no fingerprint yet) accepts nothing and records the fingerprint alone.

func ArmedLine added in v0.16.2

func ArmedLine(pr int) string

ArmedLine says what a stop leaves of a pull request armed before it, which nothing disarms on its own.

func AutoSweepForTest added in v0.17.0

func AutoSweepForTest(ctx context.Context, repoRoot string) string

AutoSweepForTest is autoSweep, for a front door's test to prove that the sweep it installs is the one the loop runs.

func CapDrainInProgress added in v0.16.2

func CapDrainInProgress(repoRoot string, lanes int) error

CapDrainInProgress gives a drain in progress that has no cap one: lanes more than it has opened. A drive is always bounded (adr-2610222222326104), and a cap is otherwise set only when a drain starts.

func CheckReviewersLaunch added in v0.17.0

func CheckReviewersLaunch(o Options, repoRoot string) error

CheckReviewersLaunch refuses a review set o's runners cannot launch (iss-2611080057001367): each reviewer of each role, at its class's model, is put to the runner configuration's CanLaunch, the admission the dispatch makes, with no host session, as a drive has none. o.Runners is the configuration the lanes will launch on, a drive's walled one. A drive asks it before it takes its checkout or opens a lane, so a reviewer no route on this machine can run is refused there, naming the role, the model and the configuration to set, rather than waiting at review for ever. A review set that does not resolve is refused in the review stage's own words.

func ClaimDriver added in v0.16.2

func ClaimDriver(repoRoot, runID string, o Options) error

ClaimDriver is the one call a driver makes before it steps a run: it records the host process this call runs under as the run's live driver, and refuses at exit 3 while another driver's process is alive (iss-2611022247128872). One gone is replaced, with an entry in the run's record, and so, for a drive's claim, is the process the drive's shell runs under where only shells run beneath it besides the drive, what it runs under and what it started (startedUnder). A table that cannot be read claims nothing and refuses nothing: a step is never stopped by the machine's process listing. A walk that names no host is a loop its session left behind (iss-2611022247128872): it claims nothing, and backs off from a live driver. Under a stop it claims nothing either: the stop is settled by the driver the run's agents ran under, and the move that follows gets the stop's refusal. Nor does it claim a run a stop halted, after the lift as before it: a step cannot move that run, and a session that tried must not stand in the way of the take-over the run waits for. The same holds of a run a drive stopped on (drive_stop.go), which no step moves either.

func ClassRoutes added in v0.17.0

func ClassRoutes(roots layered.Roots) ([]string, error)

ClassRoutes is the routes the class map resolves on roots, the machine's models.classes over the bundled map, in class order (Classes): the routes a drive's walled launch of the claude harness may take by name (runner.Config.WithClassRoutes). A map that does not resolve is refused in the review stage's own words.

func ConfigTripwire added in v0.14.0

func ConfigTripwire(repoRoot string) error

ConfigTripwire checks every run in progress in the checkout, as a step would, for a git step taken outside a run's own step (the shared network probe `abcd implement outage probe` runs): the first changed run refuses it.

func CurrentOutage added in v0.13.4

func CurrentOutage(repoRoot string) (*implement.Outage, error)

CurrentOutage is the shared run's outage in force for the checkout, nil when there is none or the checkout has no shared run state. It writes nothing.

func DrainSummaryLine added in v0.12.0

func DrainSummaryLine(r DrainRoute) string

DrainSummaryLine is a route in one line, for the text surfaces.

func DriveGate added in v0.17.0

func DriveGate(path string, hooksPaths ...string) bool

DriveGate reports whether path, relative to the checkout, is one of DriveGates, or at, under or above one of the hooks paths the repository configures, hooksPaths (DriveHooksPaths): a change list names no directory, so a path above a hooks path is an entry, such as a link, standing where one of its parents was. A directory counts with or without its trailing slash. Each part of the name is compared as a case-folding filesystem compares it, whatever this machine's filesystem does (fsutil.FoldedPathMatch). A hooks path of the tree's top makes every path a gate, as a hooks directory counts with all below it, and an empty one names none. An empty path names nothing.

func DriveHooksPaths added in v0.17.0

func DriveHooksPaths(dir string) ([]string, error)

DriveHooksPaths are the paths, relative to dir, that gate the hooks the repository at dir configures: nil for none or a value outside dir. A relative value is taken from dir, where git runs hooks from. The value is placed as its text reads, cleaned, and as the filesystem resolves it, one part at a time (hooksHops): each link met on the way is a path, named by its own place, and so is where the walk ends, so a chain of links, a link above the hooks directory and a ".." after a link each name what git reaches. Every place is compared as this machine's filesystem compares names (fsutil.RelWithin), each one inside dir is one of the paths, and the same place is named once. It is read in the person's own environment, where what lands is pushed (personEnv): git saying the key is not set (exit 1, nothing written) is none; any other failure, a read that did not finish, or an answer abcd does not take is an error naming the read, so a caller never takes a hooks directory it could not read for none.

func EstimateRuns added in v0.16.2

func EstimateRuns(o Options, repoRoot string, lanes int) (int, error)

EstimateRuns is the agent runs a drive of lanes lanes may start, by the budget check's estimate.

func HeldWorktrees added in v0.16.0

func HeldWorktrees(repoRoot string) (worktree.Held, error)

HeldWorktrees is what the build loop holds in the worktree store, for the store's prune (spc-2609301811532881): every lane of a run whose state is not complete, by the name laneName gives it in the store, read across the local tier of every checkout git lists for the repository, because a run's state lives in the checkout that started it. A state file that cannot be read holds every worktree named after its run; a run directory that cannot be listed fails the read, so prune removes nothing. It is a worktree.HeldReader.

func JudgementSummary added in v0.14.0

func JudgementSummary(j DrainJudgement) string

JudgementSummary is a judgement in one line, for the text surfaces.

func LaneBranch added in v0.17.0

func LaneBranch(name string) bool

LaneBranch reports whether name is a branch with exactly the shape the loop gives a lane: BranchPrefix followed by <run-id>-<lane-id>, each id one the loop mints (ValidRunID, ValidLaneID), as laneName composes them. A person's own branch under the prefix is not one.

func LatestRun added in v0.12.0

func LatestRun(repoRoot string) (string, error)

LatestRun names the run a record read addresses when none is named: the one run in progress when there is one, else the most recently started run in this checkout. Several runs in progress are refused, naming them; a handed-back issue run a newer run of the issue followed is not one (superseded).

func ListHostRole added in v0.16.2

func ListHostRole(ctx context.Context, repoRoot, runID string, res StepResult, cfg *runner.Config)

ListHostRole writes the launch ledger's placeholder for the role res leaves with the host, once DriveReview has had its turn, so the ledger never names a host that did not see the role. A route's answer comes back with the route named on it, and a fallback as the result Drive handed out, with none.

func LoadRunners added in v0.12.0

func LoadRunners(r layered.Roots) (*runner.Config, error)

LoadRunners reads the runner configuration (runner.Load) at the roots a lane starts from, and refuses in the loop's refusal shape on any fault, a model route its provider's allowlist does not admit included, before a run is created or a runner launched (itd-2609201916056194 criterion 5). The configuration's diagnostics are the caller's to print.

func OnAnotherProfile added in v0.17.0

func OnAnotherProfile(l LaneOnProfile, profile string) string

OnAnotherProfile says why a drive on profile does not take l up, and what the person may do instead.

func ReleaseReservation added in v0.15.0

func ReleaseReservation(repoRoot, key string, o Options) (claim.Result, error)

ReleaseReservation is `abcd build <id> --release`: it pushes a tombstone over this person's reservation on id from this copy, and changes nothing in any run's state; a later step of the run meets the release at the land fence (C36). A key that is not an intent or issue id is refused by name.

func Resolve

func Resolve(repoRoot, runID string) (string, error)

Resolve names the run a call addresses. An explicit id is checked for shape and presence; no id addresses the one run in this checkout that is not complete, and is refused naming them when there are several, or none. An issue run handed back that a newer run of the issue has followed (superseded) is not counted: the newer run is the issue's.

func RunCountRefusal added in v0.14.2

func RunCountRefusal(max int) error

RunCountRefusal is the pick's refusal of a --max below 1, which names no run count. Next refuses a negative Max with it; Max reads 0 when --max is not given, so a front door refuses an explicit --max 0 with it before calling Next, rather than let it read as no count (iss-2610121210280182).

func SetAutoSweeper added in v0.17.0

func SetAutoSweeper(f AutoSweeper) (restore func())

SetAutoSweeper installs f as the automatic sweep and answers a restore of the one before. nil installs none: nothing is swept.

func StateRelPath

func StateRelPath(runID string) string

StateRelPath is a run's state file, relative to the checkout root.

func StatusLanes added in v0.12.0

func StatusLanes(repoRoot string) ([]statusblock.Started, error)

StatusLanes is the state file read the status block's Now takes (itd-2609212103568351): one entry per run in progress, naming its intent and every lane of it alive (ruling DR6) — each lane's next stage and the roles it waits on, a held lane included — or, while no lane is alive and a spec step still waits, the run with its stage "pending". A complete run is not in a lane. An absent tier or run directory holds none. It is a statusblock.LaneReader.

func StatusPeers added in v0.12.0

func StatusPeers(repoRoot string) (statusblock.HeldBy, error)

StatusPeers is the peers read the status block's head takes (ruling CC1 of 2026-09-29): build next's own peers check, read once for the block and judged per intent, so the board's "next up" passes over exactly the intents another checkout holds that the pick passes over. It judges on behalf of no session, so every live claim is a peer's. A peer the listing cannot read fails closed on each record, as it does for the pick. An intent whose start-time footprint shares a path with another copy's live reservation is passed over too, by the pick's own overlap judgement (overlapHeld, iss-2611182334466021), and so is one whose footprint the spec cannot name, the pick's footprint exclusion. It is a statusblock.PeerReader.

func ValidLaneID

func ValidLaneID(id string) bool

ValidLaneID reports whether id is a lane id the loop opens.

func ValidRunID

func ValidRunID(id string) bool

ValidRunID reports whether id is a run id this package mints.

func WaitOutProof added in v0.16.2

func WaitOutProof(ctx context.Context, repoRoot string, o TerminalOptions, first error, prove func(context.Context) error) (string, error)

WaitOutProof waits out what stopped the drive's live proof short of a verdict: a limit, on the schedule any agent's limit waits on, or a launch that came to none, on the outage's unless it named its own wait. Each time it may go on it proves again. It returns why the wait ended the run, "" when prove has run clean or come to a verdict, and then what prove said. Nothing has started: what it may renew is what an earlier run left held.

Types

type Admitted added in v0.17.0

type Admitted = landings.Admitted

Admitted is the rule a run's lanes were admitted under, in the grammar of the `Admitted-by:` trailer its records commits carry (landings.Admitted).

type AgentState added in v0.16.2

type AgentState string

AgentState is what the record can say of an agent a lane awaits.

const (
	// AgentAlive is an agent its own process, as its launch's ledger entry names
	// it, a recorded launch's process, or its runner claim's term, says is running.
	AgentAlive AgentState = "alive"
	// AgentLost is one whose own process the ledger names has gone, whose claim's
	// term has ended or whose driver is gone, or a host's agent with no recorded
	// driver older than one reservation lease.
	AgentLost AgentState = "lost"
	// AgentUnknown is one no process of its own is recorded for and nothing yet
	// says is gone, so it is taken to be in its call: it is never restarted, and a
	// stop waits for it.
	AgentUnknown AgentState = "unknown"
	// AgentPaused is a role waiting for its runner: no agent is out.
	AgentPaused AgentState = "paused"
)

type AliveLane added in v0.13.0

type AliveLane struct {
	Lane     string  `json:"lane"`
	SpecStep int     `json:"spec_step"`
	Stage    Stage   `json:"stage"`
	Awaits   []Await `json:"awaits"`
	Hold     *Hold   `json:"hold,omitempty"`
	// Waiting is the lane's wait for its full check, with the time it began
	// (ruling DR6d-2); empty when it waits for none.
	Waiting string `json:"waiting,omitempty"`
}

AliveLane is one lane of a run with anything left, as a result reports it.

type AuditRun added in v0.12.0

type AuditRun struct {
	ReceiptID string `json:"receipt_id"`
	Request   string `json:"request"`
	// BaseSHA..HeadSHA is the whole delivery: from the base of the run's first
	// lane to this lane's head.
	BaseSHA string `json:"base_sha"`
	HeadSHA string `json:"head_sha"`
	// Worst, NotMet and Inconclusive are read from the verdict.
	Worst        string   `json:"worst,omitempty"`
	NotMet       []string `json:"not_met,omitempty"`
	Inconclusive []string `json:"inconclusive,omitempty"`
}

AuditRun is the fidelity audit the lane that closes the spec takes, once, over the whole delivery (ruling AI): the receipt the close parks for the same record, the request, the range it reads, and what the loop read from the verdict. The verdict itself is the return the run names; the close consumes it (piece 9).

type AutoPlan added in v0.16.1

type AutoPlan struct {
	// Draft is the draft's path when the run started, relative to the
	// checkout root, and Digest the "sha256:<hex>" of its bytes then.
	Draft  string `json:"draft"`
	Digest string `json:"digest"`
	// Checkout is the "sha256:<hex>" of the checkout as the start found it:
	// its HEAD, its index's entries and their flags, and its working tree
	// outside the local tier (checkoutDigest).
	Checkout string `json:"checkout"`
	// Reviews are the two reviews, the design lens first.
	Reviews []PlanReview `json:"reviews"`
	// Planned and Spec are the planned record's path and the spec plan
	// minted; empty until the plan stage ran.
	Planned string `json:"planned,omitempty"`
	Spec    string `json:"spec,omitempty"`
	// UncopiedIndex is why the start's checkout digest did not copy the
	// checkout's index (indexNotRegular, indexReplaced or indexPastBound), and
	// empty when it copied it. A digest of an uncopied index never matches
	// again, so the end check could only hand the lane back: the lane's first
	// step hands it back at once, before any plan review is handed out.
	UncopiedIndex string `json:"uncopied_index,omitempty"`
	// PlanStarted is written, with both reviews passing and the substitute
	// checked again, by the plan stage's first step, before the step that
	// runs `intent plan`. Only a begun plan records what it made; a record
	// found in planned/ is never taken as this run's plan, and the mark only
	// says, in the hand-back, whether this run might have made it.
	PlanStarted bool `json:"plan_started,omitempty"`
}

AutoPlan is an auto-plan lane's record: the draft as the start checked it, each review with the verdict the loop parsed from its return, and what the plan made.

type AutoSweeper added in v0.17.0

type AutoSweeper func(ctx context.Context, repoRoot string) string

AutoSweeper runs the automatic sweep of the repository at repoRoot under ctx and answers the line the act it follows reports, "" for none. It reads its own setting: off, it removes nothing.

type Await

type Await struct {
	// Role is the agent the host starts: an implementer, or a validator that
	// did not implement.
	Role string `json:"role"`
	// Brief is the file the agent is handed.
	Brief string `json:"brief"`
	// Receipt is where the agent writes its receipt; `implement receipt` is
	// called with this path.
	Receipt string    `json:"receipt"`
	Since   time.Time `json:"since"`
	// Kept is why a rate-limit checkpoint kept the await: its agent is gone,
	// but what it left could not be saved aside (ratelimit.go). A restart
	// re-tells an await so marked; "" for every other await.
	Kept string `json:"kept,omitempty"`
	// Answered is the reviewer route's answer its step placed at Receipt
	// (itd-6), recorded under the run's lock as it placed it; nil for every
	// other await, the host's included.
	Answered *RouteAnswer `json:"answered,omitempty"`
	// Paused is why the role waits for its runner, which failed to start it
	// (runner_pause.go): it is handed to no one, the host included, and a
	// later step retries it; nil for every other await.
	Paused *RunnerPause `json:"paused,omitempty"`
	// Running is the runner a step started for the role, claimed under the
	// lock so no other step starts a second one; nil when none is running.
	Running *RunnerClaim `json:"running,omitempty"`
	// Reviewer, Class and Model name a review set's reviewer (reviewers.go):
	// its index among its role's reviewers, the class it is asked for and the
	// <provider>/<model> route the class resolves to, which a runner is
	// handed as the request's model and a host is asked to start the agent
	// on. Nil and empty for every other await.
	Reviewer *int   `json:"reviewer,omitempty"`
	Class    string `json:"class,omitempty"`
	Model    string `json:"model,omitempty"`
	// Effort is the class's effort the reviewer is asked to run at, which a
	// runner that can pass it is handed and a host is asked for; empty for
	// every other await and for a run started before efforts.
	Effort string `json:"effort,omitempty"`
}

Await is what a lane waits on: the agent a host must start, the brief it is handed and the receipt it writes.

type CandidateSet added in v0.12.0

type CandidateSet struct {
	// Candidates pass every check, in the pick order.
	Candidates []intent.PickCandidate `json:"candidates"`
	// Excluded fail one, in record order.
	Excluded []Excluded `json:"excluded"`
}

CandidateSet is the pick's view of the planned intents.

type CheckResult

type CheckResult struct {
	Key    string     `json:"key"`
	Intent string     `json:"intent,omitempty"`
	Spec   string     `json:"spec,omitempty"`
	OK     bool       `json:"ok"`
	Checks []CheckRow `json:"checks"`
	// contains filtered or unexported fields
}

CheckResult is every pre-start check for one key.

func Check

func Check(repoRoot, key string) (CheckResult, error)

Check runs the pre-start checks for key against the checkout at repoRoot. It returns an error only for a fault in reading this checkout (the store will not load, git will not answer); a record that may not start is a result with OK false.

The rows, in order:

  • key: an intent id, or an issue id (decision 10's key). An issue key takes two rows after it and no others: eligible (the drained repository's own rule takes the issue, as `abcd drain` reads it) and peers (no peer holds it out of open/, and no session claims it).
  • ready: the implement-readiness gate (intent.Ready) — planned, criteria, the spec linked and written, and the spec not saying it is not ready (spec.Unsettled, iss-2611101318042398). Its advisory rows stay advisory here.
  • open_questions: no open question under `## Open Questions` (intent.StartChecksIn: every list item, less the settled markers).
  • claim_sections: no unanswered claim section — the mechanism prompt answered or the section absent, the scope conditions recorded.
  • hold: no `held:` on the record (iss-2609200830076665).
  • blocked: nothing the record or its open spec names in `blocked_by` is unshipped (itd-2609211116005482: an intent with an unshipped blocker is not one a run may take); a superseded blocker is followed along `superseded_by` to its replacement, transitively (ruling BZ2 of 2026-09-29).
  • steps: the spec's `## Steps` reads, and leaves a step to build.
  • peers: no peer holds the record — no sibling worktree or local branch holds it in another bucket having changed it since its merge-base with this checkout (a branch no worktree has checked out holding nothing, iss-2611090125008163), no session holds a live claim on it, and, for an intent, no other copy holds a reservation on it on origin as this checkout last fetched them (read from disk alone).

type CheckRow

type CheckRow struct {
	Name   string `json:"name"`
	OK     bool   `json:"ok"`
	Detail string `json:"detail"`
	Remedy string `json:"remedy,omitempty"`
	// contains filtered or unexported fields
}

CheckRow is one pre-start check's verdict.

type Checkpoint added in v0.14.0

type Checkpoint struct {
	Lane   string `json:"lane"`
	Branch string `json:"branch"`
	// Head is the branch's last commit, "" when git cannot name it.
	Head string `json:"head"`
	// Aside is where the rate-limited agent's uncommitted work and partial
	// receipt were saved, relative to the checkout root; "" for a lane whose
	// agents were not the ones limited.
	Aside string `json:"aside,omitempty"`
	// Out are the roles of the lane's agents still out after the checkpoint,
	// each of which may hand back its receipt inside the pause.
	Out []string `json:"out"`
	// Kept is why the limited agent's await was kept and its worktree left as
	// it was (the save aside was refused); "" when it was not.
	Kept string `json:"kept,omitempty"`
}

Checkpoint is one lane with work in flight, as a rate limit left it.

type Citer added in v0.17.0

type Citer struct {
	Role     string `json:"role"`
	Reviewer int    `json:"reviewer"`
}

Citer is one reviewer of a round: its role and its index among the role's reviewers.

type ClosedLane added in v0.17.0

type ClosedLane struct {
	Lane string `json:"lane"`
	PR   int    `json:"pr"`
	// Merged is the default branch's commit the landing records.
	Merged string `json:"merged"`
}

ClosedLane is a lane a build closed because its pull request had merged.

type Comparison added in v0.16.1

type Comparison struct {
	Role      string `json:"role"`
	Reviewers int    `json:"reviewers"`
	Outcome   string `json:"outcome"`
	// Verdicts are the role's verdicts, in reviewer order, as the loop
	// recorded them.
	Verdicts []string `json:"verdicts"`
}

Comparison is how one role's reviewers in a round compared once every one of them had returned (reviewers.go): Outcome is ComparisonAgree, ComparisonDisagree (one verdict passes and another fails), or ComparisonNone when the role ran one reviewer, so no comparison was made. The round's verdict does not hang on it: any failing reviewer fails the round, which is the stricter verdict.

type Context

type Context struct {
	RepoRoot string
	// RunDir is the run's directory, relative to RepoRoot.
	RunDir string
	State  State
	Now    time.Time
	// Await is the await a verifier is handed the receipt of; nil for a body.
	Await *Await
	// Route is the route that ran the agent whose receipt a verifier is
	// handed, when a runner ran it, with the model the runner reported; nil
	// for a body, a host-run agent and a placed answer (iss-2611022247103872).
	Route *runner.RouteRecord
	// contains filtered or unexported fields
}

Context is what a stage's body is handed: where the checkout and the run live, the run as it stood before the stage, and the clock.

type DoDRun

type DoDRun struct {
	Command  string `json:"command"`
	ExitCode *int   `json:"exit_code"`
	// Output is the run's whole output, a path inside the lane's directory.
	Output string `json:"output"`
}

DoDRun is one run of the definition of done.

type DrainBundlePreview

type DrainBundlePreview struct {
	Lead    string   `json:"lead"`
	Members []string `json:"members"`
}

DrainBundlePreview is one lane the next moves would open with members, as `abcd drain --dry-run` shows it: the lead, and the members it would take.

type DrainCounts added in v0.14.0

type DrainCounts struct {
	LanesOpened int `json:"lanes_opened"`
	InProgress  int `json:"in_progress"`
	// PullRequests are the lanes whose landing opened a pull request, done
	// or not; whether one merged is a person's gate, and not counted.
	PullRequests    int `json:"pull_requests"`
	LanesHandedBack int `json:"lanes_handed_back"`
	// Promotions, DecisionRecords and Homes are the hand-backs the drain
	// routed, from its lanes and from the host judgement, by route.
	Promotions      int `json:"promotions"`
	DecisionRecords int `json:"decision_records"`
	Homes           int `json:"homes"`
	// RuleFlags are the rule's hand-backs over the ledger as this call read it,
	// less the issues this drain promoted itself, which Promotions counts.
	RuleFlags  int        `json:"rule_flags"`
	Judgements int        `json:"judgements"`
	Passed     int        `json:"passed"`
	Spend      DrainSpend `json:"spend"`
	// HandBacksByPR are the hand-backs per pull request the drain's lanes
	// opened (itd-2610301750162657): one entry for each pull request, in the
	// order its lane opened, none left out for having no hand-back.
	// HandBacksNoPR counts the hand-backs no pull request carries: the
	// judgement's, a reservation's, a field hand-back's, and a lane's that
	// opened none.
	HandBacksByPR []DrainPRHandBacks `json:"hand_backs_by_pr"`
	HandBacksNoPR int                `json:"hand_backs_without_pr"`
}

DrainCounts are the drain's totals (itd-82 scope 8): its lanes by outcome, the pull requests they opened, its hand-backs by route, the rule's flags, the host judgements, the issues this call passed over, and the spend.

type DrainFinished added in v0.14.0

type DrainFinished struct {
	Issue string `json:"issue"`
	RunID string `json:"run_id"`
	PR    int    `json:"pr,omitempty"`
	Done  bool   `json:"done"`
	Note  string `json:"note"`
}

DrainFinished is one merged lane a drain move took the landing's last step for: Done when its worktree and branch were removed and the lane marked done, otherwise Note says why the landing refused.

type DrainForming

type DrainForming struct {
	Lead    string               `json:"lead"`
	Hold    *DrainHold           `json:"hold,omitempty"`
	Members []DrainFormingMember `json:"members"`
}

DrainForming is a bundle the drain is forming across its moves: the lead, whose judgement answered no, and each member a judgement has taken since, with the hold the drain took on each to judge it.

type DrainFormingMember

type DrainFormingMember struct {
	Issue string     `json:"issue"`
	Hold  *DrainHold `json:"hold,omitempty"`
}

DrainFormingMember is one member of a forming bundle and its hold.

type DrainHold added in v0.15.1

type DrainHold struct {
	Commit        string    `json:"commit"`
	ClaimedAt     time.Time `json:"claimed_at"`
	ExpiresAt     time.Time `json:"expires_at"`
	ForkUnchecked string    `json:"fork_unchecked,omitempty"`
	ForkAllowed   string    `json:"fork_allowed,omitempty"`
}

DrainHold is a reservation the drain took on an issue to judge it: the commit its push made, and when it was claimed and lapses. The drain releases that commit and no other, so a reservation this person made or renewed by hand since is left as it stands. ForkUnchecked and ForkAllowed are the fork check the act could not make or waived (claim's Result), kept so the lane a no opens on the hold says so as a lane that reserved for itself does (spc-2610161044461448 step 10).

type DrainJudgement added in v0.14.0

type DrainJudgement struct {
	Issue        string    `json:"issue"`
	RemedySHA256 string    `json:"remedy_sha256"`
	Answer       string    `json:"answer"`
	Kind         string    `json:"kind,omitempty"`
	Reason       string    `json:"reason"`
	Applied      bool      `json:"applied"`
	Note         string    `json:"note,omitempty"`
	At           time.Time `json:"at"`
	// Hold is the reservation the answer was asked on, nil when the drain
	// took none: the lane a no opens on it, in this move or a later one,
	// names the fork check it could not make or waived.
	Hold *DrainHold `json:"hold,omitempty"`
	// Route is the runner that answered, when the drain's judge is routed to
	// one (drain_judge.go); nil for the host's answer.
	Route *runner.RouteRecord `json:"route,omitempty"`
}

DrainJudgement is one answer the drain took: the question's answer, the kind a yes names, the host's reason, and whether it decided the issue's disposition (Applied) or, the issue having left the eligible set since the request, decided nothing (Note says why).

type DrainJudging added in v0.14.0

type DrainJudging struct {
	Issue        string    `json:"issue"`
	RemedySHA256 string    `json:"remedy_sha256"`
	Request      string    `json:"request"`
	Answer       string    `json:"answer"`
	RequestedAt  time.Time `json:"requested_at"`
	// Hold is the reservation the drain took on the issue to ask this
	// judgement; nil when it took none (no origin, or this person already
	// held the issue from this copy, which is theirs and never the drain's
	// to release).
	Hold *DrainHold `json:"hold,omitempty"`
	// RoutedAsked and AdapterAsked mark who was asked this request and did
	// not answer, so the polls that follow while the host's request stands
	// ask neither again. RoutedAsked is the judge routed to a runner, true
	// once its runner was started (drain_judge.go): a judge that never
	// started (its directory not made, its request refused before any
	// launch) leaves it false, so the next move starts it. AdapterAsked is
	// the decision adapter, with eligibility-residual turned on, true once
	// it was asked and gave no answer the move could take (drain_decide.go).
	// Each is marked alone, so a failed adapter never stands for a runner
	// that never started.
	RoutedAsked  bool `json:"routed_asked,omitempty"`
	AdapterAsked bool `json:"adapter_asked,omitempty"`
}

DrainJudging is the judgement the drain awaits before it opens an issue's lane: the issue, the digest of the remedy the request showed, and where the request and the answer are.

type DrainLane added in v0.12.0

type DrainLane struct {
	Issue    string    `json:"issue"`
	RunID    string    `json:"run_id"`
	OpenedAt time.Time `json:"opened_at"`
	Outcome  string    `json:"outcome"`
	PR       int       `json:"pr,omitempty"`
	// Bundle is the members the lane took beside its issue, the lead; empty
	// for a lane of one issue. Split marks a bundle the drain split after it
	// failed, its issues taken up again alone.
	Bundle []string `json:"bundle,omitempty"`
	Split  bool     `json:"split,omitempty"`
	// CIMinutes is the time the lane's merged pull request's checks ran, in
	// minutes; nil until it is read.
	CIMinutes *float64 `json:"ci_minutes,omitempty"`
}

DrainLane is one issue the drain handed to a lane.

type DrainLapse added in v0.15.1

type DrainLapse struct {
	Issue       string    `json:"issue"`
	RequestedAt time.Time `json:"requested_at"`
	LapsedAt    time.Time `json:"lapsed_at"`
	DroppedAt   time.Time `json:"dropped_at"`
}

DrainLapse is a judgement request the drain dropped unanswered: its issue, when it was asked, when the hold taken for it lapsed, and when the move that dropped it released that hold. The issue is not asked again before its cool-down has passed (coolDownEnds), so another account has a window to take it, and then only after the drain's other eligible work; the entry is pruned once the issue is asked again or answered.

type DrainOptions added in v0.12.0

type DrainOptions struct {
	// Max is --max as typed; 0 when not given, which is all.
	Max int
	// Judgement is --judgement: the path of the host's answer to the
	// judgement the drain awaits; empty when not given.
	Judgement string
	// Transcripts is where a routed judge's transcript lands
	// (drain_judge.go); nil leaves the judgement on the host's request,
	// routed or not.
	Transcripts runner.TranscriptStore
	// JudgeTimeout bounds one routed judgement; drainJudgeTimeout when zero.
	JudgeTimeout time.Duration
	// Context ends the move's routed judge: the front door ends it on an
	// interrupt or a termination. context.Background when nil.
	Context context.Context
	// PassOver says why an issue, given its id and found_at, is passed over
	// rather than opened; "" opens it. Nil passes nothing over.
	PassOver func(id, foundAt string) string
	// JudgeOutcome, when set, receives what became of a routed judgement.
	JudgeOutcome *JudgeOutcome
	// AskJudgeAgain asks the routed judge once per move rather than once per
	// request: a terminal drive has no host for the request to fall to, so a
	// judge that did not answer is asked again (terminal.go).
	AskJudgeAgain bool
	// KeepWaiting keeps waiting on origin, and on an outage the shared run gave
	// up on, for as long as the caller lasts: a drive under --until has a bound
	// of its own, so neither ends the drain (terminal.go).
	KeepWaiting bool
	// Skip are --skip's targets, issue ids or paths, held back for now with
	// SkipReason, --reason; Unskip are --unskip's, taken off the list
	// (drain_skip.go).
	Skip       []string
	SkipReason string
	Unskip     []string
	// PassedLanes are the run ids of lanes a drive passed over this run, each a run
	// whose file states another schema version that the drive may not save
	// (terminal.go): the move writes nothing for such a lane, neither halting it
	// under a stop, admitting, pacing, renewing, finishing nor handing it back as
	// stuck, never picks it as the lane in progress, and does not stop the drain at
	// its cap or as empty while one is in progress, so a later drive takes it up.
	// The outage and origin stops end the drain as before. Held in the drive's
	// memory alone, never written.
	PassedLanes []string
	// contains filtered or unexported fields
}

DrainOptions are the drain's own flags.

type DrainOrigin added in v0.15.1

type DrainOrigin struct {
	// Ref is the branch as a person names it (origin/main), and Commit its
	// commit as fetched.
	Ref    string `json:"ref"`
	Commit string `json:"commit"`
	// FetchedAt is when abcd last fetched here, nil when nothing here stamped
	// a fetch; AgeMinutes is the view's age then, at the plan's time.
	FetchedAt  *time.Time `json:"fetched_at"`
	AgeMinutes int        `json:"age_minutes"`
	// Behind counts the commits of Ref this checkout's HEAD lacks.
	Behind int `json:"behind"`
	// Finished are the issues open in this checkout's ledger that Ref holds
	// resolved or wontfix: the work a stale checkout would repeat.
	Finished []string `json:"finished"`
}

DrainOrigin is the view of origin's default branch a plan was read from.

type DrainOriginWait added in v0.15.1

type DrainOriginWait struct {
	Since       time.Time `json:"since"`
	Kind        string    `json:"kind"`
	Probes      int       `json:"probes"`
	NextProbeAt time.Time `json:"next_probe_at"`
	// HourlySince is the probe that began the hourly stage, nil before it.
	HourlySince *time.Time `json:"hourly_since,omitempty"`
}

DrainOriginWait is a drain waiting on origin: since when, why (one of the DrainOrigin* kinds), the probes that failed, and when the next is due.

type DrainPRHandBacks added in v0.17.0

type DrainPRHandBacks struct {
	PR        int      `json:"pr"`
	Issue     string   `json:"issue"`
	HandBacks int      `json:"hand_backs"`
	Kinds     []string `json:"kinds"`
}

DrainPRHandBacks is one pull request's hand-backs: its lane's issue, how many hand-backs its lane routed and their kinds, each named once, in the order first routed.

type DrainParked added in v0.15.1

type DrainParked struct {
	Issue string `json:"issue"`
	RunID string `json:"run_id"`
	PR    int    `json:"pr"`
	State string `json:"state"`
	Note  string `json:"note"`
}

DrainParked is one lane parked at land whose head is not on the default branch, as the move read its pull request (spc-2610161044461448 step 8).

type DrainPendingHandBack added in v0.15.1

type DrainPendingHandBack struct {
	Issue string    `json:"issue"`
	Kind  string    `json:"kind"`
	Blob  string    `json:"blob,omitempty"`
	Why   string    `json:"why"`
	At    time.Time `json:"at"`
}

DrainPendingHandBack is a hand-back a yes routed that the move could not publish on origin: its issue, its kind, the blob of the issue's record on origin's default branch the yes was judged over ("" when it could not be read), why it is pending, and when it was routed.

type DrainPreview added in v0.15.1

type DrainPreview struct {
	capture.DrainPlan
	Origin       *DrainOrigin `json:"origin"`
	OriginUnread string       `json:"origin_unread,omitempty"`
	// OrderDrawnAtFirstMove is true when this copy has no key yet, so the
	// preview takes each group oldest first: this copy's own order within
	// each group is drawn at its first move, which mints the key, and the
	// dry run, which writes nothing, mints none.
	OrderDrawnAtFirstMove bool `json:"order_drawn_at_first_move"`
	// BundleMax is the cap the next move bundles under: a running drain's
	// own, or the one a drain started now would take from the files.
	// Bundles are the lanes with members the plan would open under it, each
	// leading issue with the members its next lane would take, and
	// BundleNote what may make each smaller; both empty under a cap of 1
	// (drain_bundle.go).
	BundleMax  PaceValue            `json:"bundle_max"`
	Bundles    []DrainBundlePreview `json:"bundles,omitempty"`
	BundleNote string               `json:"bundle_note,omitempty"`
	// BundleMaxIgnored names a repository's drain.bundle_max above the cap
	// it may only lower, which the files' cap ignored; "" when none was.
	BundleMaxIgnored string `json:"bundle_max_ignored,omitempty"`
}

DrainPreview is `abcd drain --dry-run`: the plan, and the view of origin it was read from. Origin is nil in two cases, and the plan is then the checkout's own ledger: in a checkout with no remote named origin, where OriginUnread is empty, since there is no origin to read; and when origin's default branch as last fetched cannot be read (this checkout names none, or its commit does not resolve), where OriginUnread says why.

func DrainDryRun added in v0.15.1

func DrainDryRun(repoRoot string, now time.Time) (DrainPreview, error)

DrainDryRun plans the drain as its next move would, from origin's default branch as last fetched, and fetches and writes nothing.

type DrainProgress added in v0.16.2

type DrainProgress struct {
	Live  bool
	Max   int
	Lanes int
}

DrainProgress is the drain in progress in this checkout, as a drive reads it before its yes.

func ReadDrainProgress added in v0.16.2

func ReadDrainProgress(repoRoot string) (DrainProgress, error)

ReadDrainProgress reads the drain in progress, if any.

type DrainResult added in v0.12.0

type DrainResult struct {
	State string `json:"state"`
	// Started is true when this invocation began a new drain.
	Started  bool     `json:"started"`
	Rule     string   `json:"rule"`
	Loosened []string `json:"loosened"`
	Order    string   `json:"order"`
	Max      int      `json:"max"`
	Pace     *Pace    `json:"pace"`
	// Lanes are every lane the drain opened, with its outcome as last read.
	Lanes []DrainLane `json:"lanes"`
	// Lane is the lane in progress after this call, if any.
	Lane *DrainLane `json:"lane"`
	// Start is the run this call started, when it opened a lane.
	Start *StartResult `json:"start"`
	// Routed are the hand-backs this call routed; HandBacks every one the
	// drain has routed; Flags the rule's hand-backs over the ledger as this
	// call read it, each naming its rule, written nowhere, less the issues
	// this drain promoted itself (fieldFlags).
	Routed    []DrainRoute `json:"routed"`
	HandBacks []DrainRoute `json:"hand_backs"`
	Flags     []DrainRoute `json:"flags"`
	// Judging is the host judgement the drain awaits after this call, if any;
	// Judged the answer this call took; Judgements every answer the drain
	// has taken, each with whether it decided the issue's disposition.
	Judging    *DrainJudging    `json:"judging"`
	Judged     *DrainJudgement  `json:"judged,omitempty"`
	Judgements []DrainJudgement `json:"judgements"`
	// Passed are eligible issues this call did not take, each with why.
	Passed         []Excluded             `json:"passed"`
	Dispositions   []capture.DrainVerdict `json:"dispositions"`
	NextEligibleAt *time.Time             `json:"next_eligible_at"`
	// WaitingUntil is when a drain waiting at the cap, or on held work alone,
	// looks again, and Waiting which it waits on (drain_wait.go).
	WaitingUntil *time.Time `json:"waiting_until"`
	Waiting      string     `json:"waiting,omitempty"`
	Stopped      string     `json:"stopped,omitempty"`
	Complete     bool       `json:"complete"`
	// Finished are the merged lanes this call took the landing's last step
	// for, outside the window clock (drain_finish.go).
	Finished []DrainFinished `json:"finished"`
	// Parked are the lanes parked at land whose head is not on the default
	// branch, each as its pull request read (drain_finish.go).
	Parked []DrainParked `json:"parked"`
	// Counts are the drain's totals as this call leaves it (scope 8).
	Counts DrainCounts `json:"counts"`
	Next   string      `json:"next"`
	// Origin is the view of origin's default branch this move planned from,
	// and OriginWait the wait a move that could not read it is in
	// (drain_origin.go); both nil in a checkout with no remote named origin.
	Origin     *DrainOrigin     `json:"origin,omitempty"`
	OriginWait *DrainOriginWait `json:"origin_wait,omitempty"`
	// PendingHandBacks are the hand-backs routed and not yet published on
	// origin, as this call leaves them (drain_pending.go).
	PendingHandBacks []DrainPendingHandBack `json:"pending_hand_backs,omitempty"`
	// Skips is the drain's skip list as this call leaves it: empty once the
	// drain has ended, which clears it (drain_skip.go).
	Skips []DrainSkip `json:"skips"`
	// contains filtered or unexported fields
}

DrainResult is one drain invocation's summary.

func Drain added in v0.12.0

func Drain(repoRoot string, o Options, d DrainOptions) (DrainResult, error)

Drain performs one move of the drain run: it begins a drain when none is in progress, honours the window clock, routes the last lane's outcome, and opens the next eligible issue's lane, or says why it opens none. A drain without the repository's rule is refused before anything is written.

A move that finished a merged lane (finishMerged), or that ended the drain, then sweeps on its own once (autosweep.go), the sweep's line joining the move's Next; a drive's move that ends the drain leaves that to the drive's own end. A refused move sweeps nothing, and the sweep never refuses one.

type DrainRoute added in v0.12.0

type DrainRoute struct {
	Issue string `json:"issue"`
	// From is "lane" for a lane's hand-back, "judgement" for the host
	// judgement's before any lane opened, "reservation" for an issue the
	// drain could not reserve (its found_at names no path), "field" for the
	// rule's.
	From  string `json:"from"`
	Kind  string `json:"kind"`
	Route string `json:"route"`
	// Draft is the intent draft a promotion made; Question the question a
	// decision-record flag states; Rule the rule a field hand-back names; Home
	// the home a flag names.
	Draft    string `json:"draft,omitempty"`
	Question string `json:"question,omitempty"`
	Rule     string `json:"rule,omitempty"`
	Home     string `json:"home,omitempty"`
	Reason   string `json:"reason"`
	// Wrote is the record change the route made, in words; "nothing" for a
	// flag.
	Wrote string     `json:"wrote"`
	At    *time.Time `json:"at,omitempty"`
	// Blob is the blob id of the issue's record on origin's default branch
	// when the hand-back was routed, "" without origin: once that record
	// changes, the drain takes the issue up again (drain_readmit.go).
	Blob string `json:"blob,omitempty"`
}

DrainRoute is one hand-back and where it went.

type DrainSkip added in v0.16.0

type DrainSkip struct {
	Target string    `json:"target"`
	Reason string    `json:"reason"`
	At     time.Time `json:"at"`
}

DrainSkip is one entry of the drain's skip list: an issue id, or a repository-relative path that holds back every issue whose found_at path lies in it or contains it, with the person's reason and when it was given.

type DrainSpend added in v0.14.0

type DrainSpend struct {
	AgentRuns    int      `json:"agent_runs"`
	Implementers int      `json:"implementers"`
	Validators   int      `json:"validators"`
	Unread       []string `json:"unread"`
}

DrainSpend is what the drain's lanes have spent, in agent runs, the unit the budget check estimates a run in: each implementer's receipt the loop verified (the implement stage's, each fix round's, a hand-back's) and each validator's return it parsed a verdict from. No runner reports tokens or money, so neither is counted. Unread names a lane's run whose state could not be read, which makes the counts a floor.

type DrainState added in v0.12.0

type DrainState struct {
	SchemaVersion int       `json:"schema_version"`
	StartedAt     time.Time `json:"started_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	// Rule is the decision record the rule was read from when the drain began.
	Rule string `json:"rule"`
	// Max is the cap on lanes the drain opens; 0 is all (the default).
	Max int `json:"max"`
	// Pace is the pace the drain started on; its window and pause bound the
	// drain as they bound a run.
	Pace            *Pace        `json:"pace"`
	WindowStartedAt *time.Time   `json:"window_started_at,omitempty"`
	NextEligibleAt  *time.Time   `json:"next_eligible_at,omitempty"`
	Lanes           []DrainLane  `json:"lanes"`
	HandBacks       []DrainRoute `json:"hand_backs"`
	// Judging is the host judgement the drain awaits before it opens the next
	// issue's lane (scope 3), and Judgements every answer it has taken.
	Judging    *DrainJudging    `json:"judging,omitempty"`
	Judgements []DrainJudgement `json:"judgements,omitempty"`
	// JudgeFallbacks are the receipts of every routed judgement a runner did
	// not answer, each left to the host's request (drain_judge.go).
	JudgeFallbacks []runner.FallbackReceipt `json:"judge_fallbacks,omitempty"`
	// Lapsed are the judgement requests dropped unanswered once the hold the
	// drain took for them lapsed, the latest last; their issues are asked
	// again only once a cool-down has passed, and then only after the
	// drain's other eligible work (drain_hold.go).
	Lapsed []DrainLapse `json:"lapsed,omitempty"`
	// PendingHandBacks are the hand-backs a yes routed whose tombstone the
	// move could not publish (drain_pending.go); each is published over the
	// issue's next release on origin, and carried into the next drain.
	PendingHandBacks []DrainPendingHandBack `json:"pending_hand_backs,omitempty"`
	// Stopped says why the drain ended, and EndedAt when; empty while it runs.
	Stopped string     `json:"stopped,omitempty"`
	EndedAt *time.Time `json:"ended_at,omitempty"`
	// OriginWait is the wait on origin a move that could not read it began
	// (drain_origin.go); nil while origin answers.
	OriginWait *DrainOriginWait `json:"origin_wait,omitempty"`
	// WaitingUntil is when a drain waiting at its holder's cap, or on work
	// others hold alone, looks again, and Waiting which of the two it waits
	// on (DrainWaitCap, DrainWaitHeld); both empty otherwise. It is kept
	// apart from NextEligibleAt, so a wait never resets the pace window
	// (drain_wait.go).
	WaitingUntil *time.Time `json:"waiting_until,omitempty"`
	Waiting      string     `json:"waiting,omitempty"`
	// Skips are the issues and paths a person holds back for now, each with
	// its reason; the list clears when the drain ends (drain_skip.go).
	Skips []DrainSkip `json:"skips,omitempty"`
	// BundleMax is drain.bundle_max as the drain started with it, the layer
	// and origin it came from: the most issues one lane takes. A running
	// drain keeps it, whatever the files say by then (drain_bundle.go). Nil
	// reads as the bundled cap.
	BundleMax *PaceValue `json:"bundle_max,omitempty"`
	// Forming is the bundle the drain's moves are forming, its lead and the
	// members judged so far, each with its hold; nil while none forms.
	Forming *DrainForming `json:"forming,omitempty"`
}

DrainState is one drain, between invocations.

type Driver

type Driver string

Driver names what drives the loop. The host session is decision 5's default; the process driver is piece 3's, opt-in by configuration.

const DriverHost Driver = "host"

DriverHost is a host session calling `implement step` and `implement receipt` itself.

type Entry

type Entry struct {
	At   time.Time `json:"at"`
	Lane string    `json:"lane,omitempty"`
	// Stage is the stage the entry records: a lane stage, "start", "open" (a
	// later lane opened for its spec step) or "receipt".
	Stage string `json:"stage"`
	Note  string `json:"note,omitempty"`
	// Issue is the issue a reservation line is for, written only in a run with
	// members (itd-2611201450052326), so one issue's line is never read as
	// another's; a run with members reads a reservation line naming none as
	// the lead's (lineIssue).
	Issue string `json:"issue,omitempty"`
}

Entry is one line of the run record.

type Excluded added in v0.12.0

type Excluded struct {
	ID     string `json:"id"`
	Check  string `json:"check"`
	Reason string `json:"reason"`
}

Excluded is a planned intent the pick did not consider, with the first check that excluded it.

type Finding added in v0.17.0

type Finding struct {
	// File is the path the finding cites, relative to the lane's worktree,
	// and Line the line, from 1.
	File string `json:"file"`
	Line int    `json:"line"`
	// Status is what the round's fix report says of it: FindingApplied,
	// FindingRejected or FindingUnknown; empty until a fix report is
	// verified, and on the findings of a reviewer that passed the round,
	// which no fix brief hands on.
	Status string `json:"status,omitempty"`
	// Reason is the round's judge's reason for striking the finding, set
	// exactly where Status is FindingStruck (judge.go).
	Reason string `json:"reason,omitempty"`
	// CitedBy names every reviewer of the round citing the same file and
	// line, this one included, in the round's validator order; absent when
	// only this reviewer cites it.
	CitedBy []Citer `json:"cited_by,omitempty"`
}

Finding is one located finding a reviewer's return cites.

type ForgeState added in v0.17.0

type ForgeState string

ForgeState is what the forge says of a lane's pull request.

const (
	ForgeOpen        ForgeState = "open"
	ForgeArmed       ForgeState = "armed"
	ForgeConflicting ForgeState = "conflicting"
	ForgeMerged      ForgeState = "merged"
	ForgeClosed      ForgeState = "closed"
	ForgeUnread      ForgeState = "unread"
)

The states a take-over reads a lane's pull request in.

type HandBack added in v0.12.0

type HandBack struct {
	At time.Time `json:"at"`
	// Kind, Reason and Home are set when the lane's own receipt handed the work
	// back (itd-82 scope 5): the kind of decision it found, what it found, and
	// where the decision belongs. Discarded is the lane's head the loop
	// discarded with its worktree and branch. The fields below are then empty.
	Kind      string `json:"kind,omitempty"`
	Reason    string `json:"reason,omitempty"`
	Home      string `json:"home,omitempty"`
	Discarded string `json:"discarded,omitempty"`
	// Verdict is VerdictUnachievable.
	Verdict string `json:"verdict,omitempty"`
	// Round is the round that did not pass once the cap was reached, and
	// FixRounds the cap the run held the lane to.
	Round     int `json:"round,omitempty"`
	FixRounds int `json:"fix_rounds,omitempty"`
	// Verdicts is the last round's verdicts as the loop recorded them, and
	// Findings the returns of the validators that did not pass, relative to
	// the checkout root.
	Verdicts string   `json:"verdicts,omitempty"`
	Findings []string `json:"findings,omitempty"`
	// NotMet and Undecided name the criteria the last audit judged not met and
	// could not decide, when the lane took the audit.
	NotMet    []string `json:"not_met,omitempty"`
	Undecided []string `json:"undecided,omitempty"`
}

HandBack is a lane stopped and handed back to the person, with what the last round found (ruling DR1 on itd-50's criterion 2).

type Handler

type Handler func(c Context, lane *Lane) (Outcome, error)

Handler performs one stage for a lane, writing what it made into lane. It must be idempotent: a process killed after the body's effect and before the state write runs the body again on the next call, so a body finds what it made last time rather than making it twice. An error leaves the state as it was; a *Refusal error is passed to the caller as the refusal.

type Hold added in v0.13.0

type Hold struct {
	Since    time.Time `json:"since"`
	Cause    string    `json:"cause"`
	Head     string    `json:"head"`
	Before   string    `json:"before"`
	Released bool      `json:"released,omitempty"`
}

Hold is a lane held after a sibling's hand-back (ruling DR6c): when, the handed-back lane that caused it, the head its passing round judged, and the landing step it stopped before (HoldBeforePush or HoldBeforeArm). Released is set once the person released it to land as it is.

type IssueHandBack

type IssueHandBack struct {
	Issue  string `json:"issue"`
	Kind   string `json:"kind"`
	Reason string `json:"reason"`
	Home   string `json:"home,omitempty"`
}

IssueHandBack is one issue of a run with members handed back alone in a receipt's `handbacks`: the issue, then the kind, reason and home a lane's own hand-back carries (LaneHandBack), each checked as handBackGaps checks that one.

type JudgeKind added in v0.16.2

type JudgeKind int

JudgeKind is what became of a routed judgement.

const (
	// JudgeNoOutcome: no routed judge was asked.
	JudgeNoOutcome JudgeKind = iota
	// JudgeNoAnswer: its runner ran it and it answered nothing usable.
	JudgeNoAnswer
	// JudgeRunnerFailed: its runner did not run it.
	JudgeRunnerFailed
	// JudgeLimited: the account's rate limit stopped it.
	JudgeLimited
)

The ends a routed judgement comes to that give no answer.

type JudgeOutcome added in v0.16.2

type JudgeOutcome struct {
	Kind JudgeKind
	// ResetsAt is when a limit resets, zero when none was reported.
	ResetsAt time.Time
}

JudgeOutcome is what became of a routed judgement.

type JudgeStrike

type JudgeStrike struct {
	File   string `json:"file"`
	Line   int    `json:"line"`
	Reason string `json:"reason"`
}

JudgeStrike is one location a round's judge struck, with its reason.

type JudgementAnswer added in v0.14.0

type JudgementAnswer struct {
	SchemaVersion int    `json:"schema_version"`
	Issue         string `json:"issue"`
	RemedySHA256  string `json:"remedy_sha256"`
	Answer        string `json:"answer"`
	Kind          string `json:"kind,omitempty"`
	Reason        string `json:"reason"`
}

JudgementAnswer is the host's answer file, read strictly: any other field refuses it.

type Landing added in v0.12.0

type Landing struct {
	// Closes is whether this lane's landing closes the spec (and ships the
	// intent): the lane that took the fidelity audit.
	Closes bool `json:"closes"`
	// MarkStep is the spec step whose `- landed:` line the records write on
	// the open spec (iss-2610110918418459): the lane's step, on an intent lane
	// of a spec that lists its steps; 0 when there is none to mark.
	MarkStep int `json:"mark_step,omitempty"`
	// Records is the loop's records commit on the lane's branch, and
	// RecordsDone is set once it is made, or once there was nothing to record.
	Records     string `json:"records,omitempty"`
	RecordsDone bool   `json:"records_done"`
	// SpecSettled says the first step took an uncommitted change to the lane's own
	// spec record, so the records commit has that to carry whatever else it holds.
	SpecSettled bool `json:"spec_settled,omitempty"`
	// PreflightReceipt is the preflight receipt that named the pushed head,
	// home-redacted, and Pushed the head the loop pushed.
	PreflightReceipt string `json:"preflight_receipt,omitempty"`
	Pushed           string `json:"pushed,omitempty"`
	// Body is the pull request's body as the loop composed it, relative to the
	// checkout root; PRURL is the pull request, and BodyChecked is set once the
	// body the forge holds was re-read and found clean.
	Body        string `json:"body,omitempty"`
	PRURL       string `json:"pr_url,omitempty"`
	BodyChecked bool   `json:"body_checked"`
	// Merge is the merge rule the ruleset gave, and Armed whether auto-merge
	// was armed by it. Nothing is pushed to the lane once Merge is set.
	Merge string `json:"merge,omitempty"`
	Armed bool   `json:"armed"`
	// Toggles counts how many times the watch toggled the arming at the pushed
	// head, which maxToggles bounds.
	Toggles int `json:"toggles,omitempty"`
	// Merged is the default branch's tip, as the remote held it, that carried
	// the pushed head when the landing cleaned the lane up.
	Merged string `json:"merged,omitempty"`
	// GateUnreadSince is when the merge gate first could not read what it asks at
	// the arming; set by the call that finds it, and cleared once it reads.
	GateUnreadSince *time.Time `json:"gate_unread_since,omitempty"`
	// CheckWaitSince is when the landing began waiting for its full check: the
	// preflight receipt naming the head it pushes (ruling DR6d-2). It is set
	// by the first call that finds no receipt, kept until the push, and
	// cleared by it.
	CheckWaitSince *time.Time `json:"check_wait_since,omitempty"`
}

Landing is the land stage's progress on one lane.

type Lane

type Lane struct {
	// ID is the lane's name inside the run: lane-1, lane-2, ….
	ID string `json:"id"`
	// Key is the record the lane delivers: itd-N, or iss-N (decision 10).
	Key string `json:"key"`
	// SpecStep is the number of the spec step the lane lands, and StepTitle its
	// title. An unstepped spec is one implicit step, number 1.
	SpecStep  int    `json:"spec_step"`
	StepTitle string `json:"step_title"`
	// Stage is the next stage the loop performs for this lane; StageDone when the
	// lane has nothing left.
	Stage Stage `json:"stage"`
	// Awaits are the agents the lane waits on: one while its implementer
	// works, one per validator while its round is out. Each is a slot of the
	// run's ceiling until its receipt is verified (criterion 8, ruling DR6).
	Awaits []Await `json:"awaits,omitempty"`
	// Syncs are the merges of the default branch into the lane after a sibling
	// landed; Hold is set while the lane is held after a sibling's hand-back.
	Syncs []Sync `json:"syncs,omitempty"`
	Hold  *Hold  `json:"hold,omitempty"`
	// The lane's footprint, filled by the stages that make it.
	Branch   string `json:"branch,omitempty"`
	BaseSHA  string `json:"base_sha,omitempty"`
	HeadSHA  string `json:"head_sha,omitempty"`
	Worktree string `json:"worktree,omitempty"`
	Brief    string `json:"brief,omitempty"`
	Receipt  string `json:"receipt,omitempty"`
	PR       int    `json:"pr,omitempty"`
	// PickSHA is the record-only commit at the branch base carrying the run's
	// pick entry, on the lane a picked run commits it on; the receipt verifier
	// counts the implementer's commits from after it.
	PickSHA string `json:"pick_sha,omitempty"`
	// Validation is the validate stage's record (piece 8): one round per head
	// the validators judged, the last the current one. Only the loop writes a
	// verdict into it, parsed from the validator's own return (itd-58).
	Validation []ValidationRound `json:"validation,omitempty"`
	// HandBack is set when the lane was stopped and handed back to the person:
	// its Stage is then StageHandedBack.
	HandBack *HandBack `json:"hand_back,omitempty"`
	// Receipts are the implementers' receipts the loop verified for the lane,
	// the implement stage's and each fix round's, with the model each runner
	// reported (criterion 10).
	Receipts []ReceiptRecord `json:"receipts,omitempty"`
	// Launched are the models a runner was started on for the lane's
	// implementer, fix and conflict-resolution roles, each with how many of
	// the lane's receipts were verified before it was started (reviewers.go):
	// every one is a writer of the lane from its next receipt on, whether or
	// not a receipt came back from it.
	Launched []LaunchedWriter `json:"writers_launched,omitempty"`
	// Resolves are the captures the lane's receipts declared fixed, each with
	// the lane's commit that fixed it; the landing resolves each (piece 9).
	Resolves []Resolution `json:"resolves,omitempty"`
	// Landing is the landing stage's progress (piece 9): each of its steps is
	// recorded as it completes, so a killed landing resumes at the step that
	// did not.
	Landing *Landing `json:"landing,omitempty"`
	// Refused is the lane's run of refused steps in an issue run (stuck.go):
	// the stage, check and reason of the last, how many in a row were the
	// same, and since when the lane has refused at that stage. Nil while the
	// lane's steps succeed, and in an intent's run.
	Refused *LaneRefused `json:"refused,omitempty"`
	// AutoPlan is the `abcd build --auto-plan` lane's record (autoplan.go):
	// the draft as the start checked it, its two plan reviews and what the
	// plan made. Nil on every other lane.
	AutoPlan *AutoPlan `json:"auto_plan,omitempty"`
}

Lane is one lane: one spec step, one branch, one pull request.

func (Lane) CheckWait added in v0.13.0

func (l Lane) CheckWait() string

CheckWait is the lane's wait for its full check, as the status shows it, or "" when it waits for none: a landing whose push found no preflight receipt naming its head.

type LaneAwait added in v0.13.0

type LaneAwait struct {
	Lane  string
	Await Await
}

LaneAwait is one outstanding await with the lane it belongs to.

type LaneForge added in v0.17.0

type LaneForge struct {
	State ForgeState `json:"state"`
	Note  string     `json:"note"`
}

LaneForge is a lane's pull request as the forge's one listing shows it.

type LaneHandBack added in v0.12.0

type LaneHandBack struct {
	Kind   string `json:"kind"`
	Reason string `json:"reason"`
	Home   string `json:"home,omitempty"`
}

LaneHandBack is a lane's own hand-back: the kind of decision it found, the reason in a sentence, and, for the kinds routed to a home, where the decision belongs.

type LaneOnProfile added in v0.17.0

type LaneOnProfile struct {
	RunID, Issue, Profile string
}

LaneOnProfile is a lane a drive would take up and the profile its run started on.

func LanesOnAnotherProfile added in v0.17.0

func LanesOnAnotherProfile(repoRoot, profile string) ([]LaneOnProfile, error)

LanesOnAnotherProfile names each lane this checkout's drain would drive next that started on another profile than this one: its lanes in progress, while the drain is live. Only a drain's own move rewrites the outcome it stored, so the run says too: one a session finished, or at its pull request, needs no agent until it comes back, and a drain that ended takes nothing up. A run that names no profile holds to none yet.

type LaneReceipt

type LaneReceipt struct {
	SchemaVersion int    `json:"schema_version"`
	RunID         string `json:"run_id"`
	Lane          string `json:"lane"`
	Branch        string `json:"branch"`
	// Commits are the full object names of the commits the implementer made on
	// the lane's branch.
	Commits []string `json:"commits"`
	// DefinitionOfDone is the repository's definition of done as the
	// implementer ran it.
	DefinitionOfDone *DoDRun `json:"definition_of_done"`
	// Report is the implementer's report, a path inside the lane's directory.
	Report string `json:"report"`
	// Model is the model the implementer's harness reported, as reported: the
	// binary cannot verify it.
	Model string `json:"model,omitempty"`
	// Resolves are the captures the lane fixed, each with the commit of the
	// lane that fixed it and the judgements a resolution records; the landing
	// resolves each with `capture resolve` (spec piece 9).
	Resolves []Resolution `json:"resolves,omitempty"`
	// HandBack stops the lane: the implementer found a decision inside the
	// work and hands it back rather than deciding it (itd-82 scope 5, the
	// `handback:` of decision 10 on the parent). The loop reads it before the
	// validators, discards the lane's work and ends the lane with it. A run
	// with members takes none: it hands back each issue in HandBacks.
	HandBack *LaneHandBack `json:"handback,omitempty"`
	// HandBacks are the issues of a run with members the implementer hands
	// back alone, each with its kind, reason and home as a lane's hand-back
	// carries them (itd-2611201450052326, spc-2611201455051897 step 2): the
	// loop hands that issue back to a person and lands the others. Every
	// receipt of a run with members names each issue the run still holds once,
	// in Resolves or here; a run without members takes none.
	HandBacks []IssueHandBack `json:"handbacks,omitempty"`
}

LaneReceipt is the file an implementer writes when its lane is built.

type LaneRefused added in v0.15.1

type LaneRefused struct {
	Stage  string    `json:"stage"`
	Check  string    `json:"check,omitempty"`
	Reason string    `json:"reason"`
	Count  int       `json:"count"`
	Since  time.Time `json:"since"`
	Last   time.Time `json:"last"`
	Final  string    `json:"final,omitempty"`
}

LaneRefused is a lane's run of refused steps: the stage, check and reason of the last refusal, how many in a row were that same refusal, since when the lane has refused at that stage with no quiet longer than stuckGap, and when it last refused. Final names why the refusal cannot change, "" when it can. Count is 0 on a wait on another holder's path (Refusal.pathHeld), which counts toward the minutes bound alone.

type LaneWorktree

type LaneWorktree struct {
	// Home is the caller's home, the base the store is proved real from.
	Home string
	// RootSHA keys the store on the repository.
	RootSHA string
	// StoreRel is the lane's store directory, relative to Home.
	StoreRel string
	// Path is the worktree, Home/StoreRel/<name>.
	Path string
	// Branch is the lane's branch, build/<name>.
	Branch string
	// contains filtered or unexported fields
}

LaneWorktree is where a lane's worktree lives and what it is called.

type Launch added in v0.16.2

type Launch struct {
	Lane      string    `json:"lane"`
	Role      string    `json:"role"`
	Runner    string    `json:"runner"`
	Route     string    `json:"route,omitempty"`
	Session   string    `json:"session"`
	PID       int       `json:"pid,omitempty"`
	StartUnix int64     `json:"start_unix,omitempty"`
	SlackMS   int64     `json:"slack_ms,omitempty"`
	At        time.Time `json:"at"`
}

Launch is one in-flight launch: an agent a step started through a runner, the route it runs on, and the process that started it. It stands while the await names the same runner claim; a launch's own process is what says it is alive.

type LaunchedWriter added in v0.17.0

type LaunchedWriter struct {
	Model string `json:"model"`
	After int    `json:"after"`
}

LaunchedWriter is one model a runner was started on for a role that writes into the lane, and After how many of the lane's receipts were verified before it was started.

type ListedAgent added in v0.16.2

type ListedAgent struct {
	Role  string     `json:"role"`
	State AgentState `json:"state"`
	// Receipt is the path its receipt lands at, and ReceiptArrived whether a file
	// stands there uncollected.
	Receipt        string `json:"receipt"`
	ReceiptArrived bool   `json:"receipt_arrived"`
	// Route names the runner a recorded launch started it on; "" for the host's.
	Route string `json:"route,omitempty"`
	// Launch is the launch ledger's entry for the agent's launch, and Process the
	// agent's own process as that entry names it, which State is judged by (alive
	// while it runs, lost once it has gone); "" and 0 when the ledger names
	// neither, and State is then the run's own record's word. An entry that names
	// only its launcher has a Launch and no Process (spc-2611050505250705 step 2).
	Launch  string `json:"launch,omitempty"`
	Process int    `json:"process,omitempty"`
}

ListedAgent is one agent a lane awaits, as the record can judge it.

type ListedDrain added in v0.16.2

type ListedDrain struct {
	Checkout string `json:"checkout"`
	// Judging is the issue a judgement is awaited over, "" for none.
	Judging string `json:"judging,omitempty"`
	Next    string `json:"next"`
}

ListedDrain is a checkout's drain in progress.

type ListedDriver added in v0.16.2

type ListedDriver struct {
	Session string `json:"session,omitempty"`
	PID     int    `json:"pid"`
	// State is alive, gone, or unknown when the process table could not be read.
	State string    `json:"state"`
	At    time.Time `json:"at"`
}

ListedDriver is a run's recorded driver, with whether its process still runs.

type ListedLane added in v0.16.2

type ListedLane struct {
	ID     string        `json:"id"`
	Stage  Stage         `json:"stage"`
	Branch string        `json:"branch,omitempty"`
	Agents []ListedAgent `json:"agents"`
	// PR is the lane's pull request as the state names it; 0 for none.
	PR int `json:"pr,omitempty"`
	// BaseMoved is how many commits origin's default branch, as last fetched, is
	// past the lane's base; nil when that cannot be told.
	BaseMoved *int `json:"base_moved,omitempty"`
	// Uncommitted is how many files the lane's worktree holds uncommitted; nil
	// when it was not read, with UnreadWhy saying why.
	Uncommitted *int   `json:"uncommitted,omitempty"`
	UnreadWhy   string `json:"unread_why,omitempty"`
	// Asides are the saved-aside directories of the lane, oldest first.
	Asides []string `json:"asides,omitempty"`
	// Forge is what the forge says of the lane's pull request, read by a take-over
	// only; nil in the bare listing, which uses no network, and for no pull request.
	Forge *LaneForge `json:"forge,omitempty"`
}

ListedLane is one lane with anything left.

type ListedRun added in v0.16.2

type ListedRun struct {
	Checkout string        `json:"checkout"`
	RunID    string        `json:"run_id"`
	Key      string        `json:"key"`
	Driver   *ListedDriver `json:"driver,omitempty"`
	// Profile names the profile a drive runs it on, "" for a run no drive has driven.
	Profile string `json:"profile,omitempty"`
	// Reserved says the run holds its record's reservation as its state has it.
	Reserved bool `json:"reserved"`
	// ReleaseFailed says the run let its reservation go and the release did not reach
	// origin, so the tip stands until a renewal takes it up or its lease lapses.
	ReleaseFailed bool `json:"release_failed,omitempty"`
	// Stop is what a stop did to the run, and left.
	Stop  *RunStop     `json:"stop,omitempty"`
	Lanes []ListedLane `json:"lanes"`
	// Next is the one move this run wants of whoever reads the listing.
	Next string `json:"next"`
}

ListedRun is one run with anything left.

type Listing added in v0.16.2

type Listing struct {
	Runs   []ListedRun   `json:"runs"`
	Drains []ListedDrain `json:"drains,omitempty"`
	// Stop is the stop in force; Refused names each file the read refused.
	Stop    *runstop.Stop `json:"stop,omitempty"`
	Refused []string      `json:"refused,omitempty"`
	// Unreadable names each run state that could not be read, and why.
	Unreadable []string `json:"unreadable,omitempty"`
	// Notices names each stop another account left, which is not honoured here.
	Notices []string `json:"notices,omitempty"`
}

Listing is `abcd implement resume`: every run this account can read on the machine with anything left. The record is the whole of it, so a session that lost its context needs nothing else.

func ListRuns added in v0.16.2

func ListRuns(repoRoot, only string, o Options) (Listing, error)

ListRuns reads every run this account can on the machine: this repository's worktrees and each checkout a driver noted. It changes nothing and uses no network. One naming run keeps to that run.

type LiveDriver added in v0.16.2

type LiveDriver struct {
	// Session is the host session's id where the session-start hook recorded
	// one; "" for a plain terminal.
	Session   string    `json:"session,omitempty"`
	PID       int       `json:"pid"`
	StartUnix int64     `json:"start_unix"`
	SlackMS   int64     `json:"slack_ms,omitempty"`
	At        time.Time `json:"at"`
}

LiveDriver is the process driving a run: the host session a step runs under, or the plain terminal's own.

type Member

type Member struct {
	Issue      string     `json:"issue"`
	Footprint  []string   `json:"footprint"`
	ReservedAt *time.Time `json:"reserved_at,omitempty"`
	HandBack   *HandBack  `json:"hand_back,omitempty"`
	Split      bool       `json:"split,omitempty"`
}

Member is one issue a run carries beside its lead (itd-2611201450052326, spc-2611201455051897 step 1): its id, the footprint it is reserved with, when the run reserved it on the shared remote, its hand-back once it is handed back alone, and whether the drain has split the run.

type NextOptions added in v0.12.0

type NextOptions struct {
	// Max is --max as typed; 0 when not given. An explicit --max 0 is told
	// apart from an absent flag only at the front door, which refuses it with
	// RunCountRefusal.
	Max int
	// UntilEmpty is --until-empty.
	UntilEmpty bool
}

NextOptions are the run count the caller asked for.

type NextResult added in v0.12.0

type NextResult struct {
	CandidateSet
	Pick   *intent.Pick  `json:"pick"`
	Entry  string        `json:"entry"`
	Start  *StartResult  `json:"start"`
	Series *SeriesResult `json:"series"`
	Next   string        `json:"next"`
}

NextResult is what Next returns: the candidate set, the pick, the entry it writes, and the run it started; Pick and Start are nil when a series' move picked nothing (its last pick is in progress, its window has elapsed, or it ended). Series is the series the call moved, nil for the default single pick; Next is the move to make.

func Next added in v0.12.0

func Next(repoRoot string, o Options, n NextOptions) (NextResult, error)

Next picks the readiest planned intent and starts its run. An empty candidate set is refused naming every excluded intent and its check, and writes nothing. With --max above 1 or --until-empty it begins a series (nextseries.go); while a series is in progress every call continues it, and a count other than the series' own is refused. The pick's entry is checked against the grounds writer's own gate before the run starts, so a pick never starts a run whose reason it cannot write.

type NextSeries added in v0.14.0

type NextSeries struct {
	SchemaVersion int       `json:"schema_version"`
	StartedAt     time.Time `json:"started_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	// Max is the cap on picks; 0 with UntilEmpty, which picks until no
	// candidate is left.
	Max        int  `json:"max"`
	UntilEmpty bool `json:"until_empty"`
	// Flags are the pace flags as typed when the series began; every run the
	// series starts is started with them, so each runs on the series' pace.
	Flags SeriesFlags `json:"flags"`
	// Pace is the pace the series began on; its window and pause bound when
	// the series picks.
	Pace            *Pace        `json:"pace"`
	WindowStartedAt *time.Time   `json:"window_started_at,omitempty"`
	NextEligibleAt  *time.Time   `json:"next_eligible_at,omitempty"`
	Picks           []SeriesPick `json:"picks"`
	// Stopped says why the series ended, and EndedAt when; empty while it
	// runs.
	Stopped string     `json:"stopped,omitempty"`
	EndedAt *time.Time `json:"ended_at,omitempty"`
}

NextSeries is one series of picks, between invocations.

type Options

type Options struct {
	// ReceiptOwn, on a drive, says whether a preflight receipt for a head is one
	// the driver's own preflight minted; nil takes any.
	ReceiptOwn func(sha string) bool
	// RunStateWatch has a walled launch compare what the driver wrote with what
	// stands after the launch.
	RunStateWatch bool
	// ClassMapRead, on a drive, is handed the routes of every class map a
	// review set is resolved from (the machine's models.classes over the
	// bundled map, never a repository's or a run's stored state), as each
	// run starts; the drive adds them to the routes its walled launch takes
	// by name (runner.Config.AddClassRoutes). nil does nothing.
	ClassMapRead func(routes []string)
	// Now is the clock; nil means time.Now.
	Now func() time.Time
	// AcceptConfig is `implement step --accept-config-change` given with
	// --discard, --release or --restart: a changed git configuration the run
	// tripwire would refuse is accepted in the same write as the move it goes
	// with (acceptWith), so a move refused writes no acceptance either.
	AcceptConfig bool

	// Minter mints the run id; the zero value is production.
	Minter recordid.Minter
	// Session is the joined session of the shared run state
	// (~/.abcd.noindex/runs/<root-sha>/) a new run is started for. When set, Start
	// claims the intent for it there, so a build of the same intent from any
	// other checkout of the repository sees the run before its lane has moved
	// or claimed anything (iss-2609252050506863). Empty, the run holds no
	// claim and is invisible to another checkout until its lane shows.
	Session string
	// Pace, SubAgents and FixRounds are the --pace, --sub-agents and
	// --fix-rounds flags as typed; nil when the flag was not given. They set a
	// new run's pace over every configured layer.
	Pace, SubAgents, FixRounds *string
	// Roots are where the pace's configuration layers are read; nil reads
	// them at layered.RootsFor(repoRoot).
	Roots *layered.Roots
	// NetworkProbe proves the network back for the shared outage probe a
	// step runs when it is due; nil is implement.RemoteProbe at the checkout.
	NetworkProbe func() (bool, string)
	// OutageSession is the session the shared outage is recorded and probed for
	// when no other is known, and it keeps probing past the schedule's give-up: a
	// terminal drive's under a bound, which has a bound of its own. Unlike Session
	// it claims nothing in the shared run.
	OutageSession string
	// RunnerFailed is told of each launch that failed, with what it showed; nil
	// tells no one. A terminal run reads a limit and keeps its evidence from it.
	RunnerFailed func(role string, fl *runner.Failure)
	// RunnerStarting is told of each agent about to start, by role; nil tells no
	// one. A terminal run says so on its screen and in its log.
	RunnerStarting func(role string)
	// Runners is the runner configuration read before a run is created
	// (LoadRunners). A new run's budget check (budget.go) asks each runner a
	// role of the run is routed to for its remaining quota; nil leaves every
	// role on the host, which reports none.
	Runners *runner.Config
	// Quota asks the named runner for its remaining quota, under ctx's
	// deadline; nil asks Runners.
	Quota func(ctx context.Context, name string) (runner.Quota, bool, error)

	// Tiers is the model-tier routing a step resolves the tier of each role
	// its rounds hand out through (escalate.go; spc-2609251028149555, AC 10):
	// the routing tables and the machine's connections. Nil records no route.
	Tiers *Tiering

	// AutoPlan is `abcd build --auto-plan` (autoplan.go): a draft intent is
	// planned by the run, on adr-2610310235000654's substitute for the
	// sign-off, in place of being refused as not planned. An intent already
	// planned is built as it would be without it; an issue key is refused.
	AutoPlan bool

	// PlanGuard is the front door's rule for a step that writes the intent
	// and spec records in this checkout, as an auto-plan lane's plan does
	// (autoplan.go): it is called under the run's lock immediately before
	// `intent plan` runs, and an error refuses the step as it is, the lane
	// left at its plan and the run's state unwritten. Nil guards nothing.
	PlanGuard func() error

	// Profile is the profile a drive runs on, by name, which a run it starts records
	// (drive_profile.go); "" for anything but a drive.
	Profile string

	// Trial starts the run in the loop's trial mode (trial.go): a model-matrix
	// copy, which takes no reservation and no shared-run claim and lands
	// nothing. A trial resumes only a trial, and a build never resumes one.
	Trial bool
	// Frozen is a trial's frozen commit, the one every lane of the run is cut
	// from: the full id of the checkout's head, its copy's clone in the clone
	// store, which is the only checkout a trial runs in. Only a trial names
	// one.
	Frozen string

	// TakeOver is `abcd build --take-over`: the start's reservation moves
	// this person's own live reservation from another copy to this one. It
	// never moves another person's.
	TakeOver bool
	// contains filtered or unexported fields
}

Options are the seams tests set; the zero value is production.

type OutageDone added in v0.13.4

type OutageDone struct {
	Landed       []string   `json:"landed"`
	PullRequests []OutagePR `json:"pull_requests"`
}

OutageDone is what a run that gave up had done: the lanes landed and the pull requests it opened that have not landed.

type OutageInfo added in v0.13.4

type OutageInfo struct {
	Since       time.Time  `json:"since"`
	Services    []string   `json:"services"`
	Down        []string   `json:"down"`
	Probes      int        `json:"probes"`
	NextProbeAt *time.Time `json:"next_probe_at,omitempty"`
	// Retried is what the lanes were doing when they lost the connection.
	Retried  []string    `json:"retried"`
	GaveUpAt *time.Time  `json:"gave_up_at,omitempty"`
	Done     *OutageDone `json:"done,omitempty"`
	Left     *OutageLeft `json:"left,omitempty"`
	// Notify is true from the give-up until a session acknowledges it.
	Notify bool `json:"notify"`
}

OutageInfo is what an outage holds a refusal or a step to: when it began, the services down, the probes so far and the next one due; for a run that gave up, when it did, what the run had done and what is left, and whether the product thinker's notification is still pending.

type OutageLane added in v0.13.4

type OutageLane struct {
	Lane     string `json:"lane"`
	SpecStep int    `json:"spec_step"`
	Stage    Stage  `json:"stage"`
}

OutageLane is one lane left, at its stage.

type OutageLeft added in v0.13.4

type OutageLeft struct {
	Lanes   []OutageLane  `json:"lanes"`
	Pending []PendingStep `json:"pending"`
}

OutageLeft is what a run that gave up has left: each lane with work and its stage, and the spec steps no lane has opened for.

type OutagePR added in v0.13.4

type OutagePR struct {
	Lane string `json:"lane"`
	PR   int    `json:"pr"`
	// Merge is what the landing did with it: armed, or left open.
	Merge string `json:"merge,omitempty"`
}

OutagePR is one pull request a lane opened.

type Outcome

type Outcome struct {
	Await *Await
	// HandBack stops the lane: it is handed back to the person with what the
	// stage found, and the loop starts nothing further for it (itd-50,
	// criterion 2). Set only with no Await.
	HandBack *HandBack
	// Stay records a step of a stage that takes several invocations (the
	// landing): the lane's changes are written and the record gets the note,
	// and the lane stays at the stage for the next invocation's step. Set only
	// with no Await and no HandBack.
	Stay bool
	// Goto sends the lane back to an earlier stage (the landing's sync sends
	// it to a fresh round); set only with no Await, HandBack or Stay.
	Goto Stage
	// LandLeft is set by a landing body that sends the lane back: the sync,
	// once it has reserved an issue's whole found_at again, before it changed
	// anything locally (reserveOnLeavingLand), so the move does not judge
	// the reservation a second time; and a records round, which takes no fix
	// round and so needs no wider reservation. Reservation is the run record's line for
	// a widening it made, "" when the reservation already covered the found_at.
	LandLeft    bool
	Reservation string
	// Note is the run record's line for the stage.
	Note string
	// contains filtered or unexported fields
}

Outcome is what a stage's body returns. A body that hands its work to an agent returns Await: the lane then waits on the receipt it names and the stage completes only when Receipt verifies it.

type Pace added in v0.12.0

type Pace struct {
	WorkMinutes  PaceValue `json:"work_minutes"`
	PauseMinutes PaceValue `json:"pause_minutes"`
	SubAgents    PaceValue `json:"sub_agents"`
	FixRounds    PaceValue `json:"fix_rounds,omitzero"`
}

Pace is a run's pace: the working window, the pause after it, the ceiling on this run's lanes and validators alive at once, and the fix rounds a lane may take before it is handed back. FixRounds is zero in a run a state file before version 6 holds: it started before the pace carried the cap, and FixRoundCap reads the bundled value for it.

func (Pace) String added in v0.12.0

func (p Pace) String() string

String renders the pace and where each number came from, as the run record and the text surfaces name it.

type PaceValue added in v0.12.0

type PaceValue struct {
	Value  int    `json:"value"`
	Layer  string `json:"layer"`
	Origin string `json:"origin"`
}

PaceValue is one of the pace's numbers with the layer that supplied it: "flag", "repo", "machine" or "bundled", and the origin — the flag as typed, the file, or "bundled".

type PassedLane added in v0.17.0

type PassedLane struct {
	Issue  string `json:"issue"`
	Run    string `json:"run"`
	Reason string `json:"reason"`
}

PassedLane is a lane a drive passed over: its run's file states another schema version, and the judge of a whole save (mayWholeSave) refused this drive the save taking it up or taking it over needs. Reason is that judge's reason and remedy. From the pass to the drive's end, whatever the reason, the drive writes nothing for the lane: no save, claim, reservation pushed or renewed, or line in its record, and no agent runs for it.

type PendingStep

type PendingStep struct {
	Number int    `json:"number"`
	Title  string `json:"title"`
	// Needs are the spec steps it waits for, as its `- needs:` line or the
	// default (every earlier step, ruling DR6b) resolved them; nil in a file
	// before version 9, which reads as the default.
	Needs []int `json:"needs"`
}

PendingStep is a spec step the run will open a lane for.

type PlanReview added in v0.16.1

type PlanReview struct {
	Lens    string `json:"lens"`
	Role    string `json:"role"`
	Brief   string `json:"brief"`
	Return  string `json:"return"`
	Verdict string `json:"verdict,omitempty"`
	Pass    bool   `json:"pass"`
}

PlanReview is one review of the draft: the lens it judges by, the agent it is started as, its brief and return, and the verdict the loop parsed.

type PreflightRefused added in v0.16.2

type PreflightRefused struct{ Reason string }

PreflightRefused is why a lane's preflight is not run.

func (*PreflightRefused) Error added in v0.16.2

func (e *PreflightRefused) Error() string

type RateLimit added in v0.14.0

type RateLimit struct {
	Lane        string       `json:"lane"`
	Role        string       `json:"role"`
	Runner      string       `json:"runner"`
	Response    string       `json:"response"`
	Checkpoints []Checkpoint `json:"checkpoints"`
	// contains filtered or unexported fields
}

RateLimit is a runner's rate-limit response as a step reports it: the lane and the agent it came from, the runner, the response in abcd's words, and every lane it checkpointed.

type ReceiptRecord added in v0.12.0

type ReceiptRecord struct {
	Role    string `json:"role"`
	Receipt string `json:"receipt"`
	// Model is the model the runner reported, as reported; empty when it
	// reported none. The binary cannot verify it.
	Model string `json:"model,omitempty"`
	// Route is the route that ran the agent when a runner ran it: the runner
	// asked for, the one that ran and the model it reported. Absent when the
	// host ran it, so a host-run receipt reads as it always has.
	Route *runner.RouteRecord `json:"route,omitempty"`
	// Named is the model the receipt named when the landing replaced Model
	// with one its trailer can name (rereadModels), kept only where the
	// comparison can read it (keptName); empty while Model is the receipt's
	// own. The writers of the lane are read from it and from Model alike
	// (laneWriters).
	Named string `json:"named,omitempty"`
}

ReceiptRecord is one implementer's receipt the loop verified.

type RecordComparison added in v0.16.1

type RecordComparison struct {
	Round int `json:"round"`
	Comparison
}

RecordComparison is how one role's reviewers compared in one round (reviewers.go).

type RecordJudge

type RecordJudge struct {
	Round int `json:"round"`
	RoundJudge
}

RecordJudge is one round's judge (judge.go).

type RecordLane added in v0.12.0

type RecordLane struct {
	ID        string `json:"id"`
	Key       string `json:"key"`
	SpecStep  int    `json:"spec_step"`
	StepTitle string `json:"step_title"`
	Stage     Stage  `json:"stage"`
	Branch    string `json:"branch,omitempty"`
	BaseSHA   string `json:"base_sha,omitempty"`
	HeadSHA   string `json:"head_sha,omitempty"`
	// Receipts are the implementers' receipts the loop verified, each with the
	// model its runner reported.
	Receipts []ReceiptRecord `json:"receipts"`
	// Verdicts are every verdict the loop recorded, round by round.
	Verdicts []RecordVerdict `json:"verdicts"`
	// Comparisons are how each reviewer role's reviewers compared, round by
	// round, where a review set asked them for classes (reviewers.go).
	Comparisons []RecordComparison `json:"comparisons,omitempty"`
	// Judges are each round's judge, where a role's reviewers disagreed on a
	// run whose judge was active (judge.go): what it ruled and struck, or why
	// it was not launched.
	Judges []RecordJudge `json:"judges,omitempty"`
	// Resolves are the captures the lane fixed.
	Resolves []string `json:"resolves"`
	// PR is the lane's pull request, and Landing what its landing did.
	PR       int       `json:"pr,omitempty"`
	Landing  *Landing  `json:"landing,omitempty"`
	HandBack *HandBack `json:"hand_back,omitempty"`
	// AutoPlan is the auto-plan lane's record: the draft, its digest, the
	// plan reviews' verdicts as the loop recorded them, and what the plan
	// made. Absent on every other lane.
	AutoPlan *AutoPlan `json:"auto_plan,omitempty"`
}

RecordLane is one lane of the run record.

type RecordPick added in v0.14.0

type RecordPick struct {
	Lane  string `json:"lane"`
	Entry string `json:"entry"`
	intent.Pick
	Excluded []Excluded `json:"excluded"`
	// Falsified is true once a lane of the run was handed back as
	// unachievable after the run's fix rounds, and FalsifiedBy names it.
	Falsified   bool   `json:"falsified"`
	FalsifiedBy string `json:"falsified_by,omitempty"`
}

RecordPick is a run's pick as its record reads it (itd-2609211116005482 criterion 6, spc-2609212015048113 scope 8): the candidates in the pick order with their scores, the rule, the runner-up and the falsifier, as the pick made them; the planned intents the checks excluded; and whether the lane's state has met the falsifier. The intent's grounds entry is never edited: a falsified pick is named here and in the run record's lines.

type RecordVerdict added in v0.12.0

type RecordVerdict struct {
	Round   int    `json:"round"`
	HeadSHA string `json:"head_sha"`
	Role    string `json:"role"`
	Verdict string `json:"verdict"`
	Pass    bool   `json:"pass"`
	// Return is the validator's return the verdict was parsed from.
	Return string `json:"return"`
	// Route is the runner route that ran the validator; absent when the host
	// ran it.
	Route *runner.RouteRecord `json:"route,omitempty"`
	// Reviewer, Class, Model and ModelStatus are a review set's reviewer
	// (reviewers.go): its index among its role's reviewers, the class it was
	// asked for, the model the class resolved to, and whether that model was
	// only asked for, its runner reported one (beside it on Route), or the
	// reviewer route answered, which is sent no model (unsent); absent for a
	// validator no review set asked for a class.
	Reviewer    int    `json:"reviewer,omitempty"`
	Class       string `json:"class,omitempty"`
	Model       string `json:"model,omitempty"`
	Effort      string `json:"effort,omitempty"`
	ModelStatus string `json:"model_status,omitempty"`
	// Located and Findings are the reviewer's located findings (findings.go):
	// how many its return cites, 0 included, and each with what the fix
	// report said of it and who else in the round cites it; absent for the
	// intent-auditor and for a verdict recorded before the loop read them.
	Located  *int      `json:"located,omitempty"`
	Findings []Finding `json:"findings,omitempty"`
	// WriterModels, ReviewerModel and ReviewerNamed are every model that
	// wrote into the lane up to the round, the model the reviewer was asked
	// for or its runner reported, and the model its return named where that
	// is another (reviewers.go); absent on the intent-auditor and on a
	// reviewer handed out before they were recorded.
	WriterModels  []string `json:"writer_models,omitempty"`
	ReviewerModel string   `json:"reviewer_model,omitempty"`
	ReviewerNamed string   `json:"reviewer_named,omitempty"`
	// ModelsUnrecorded marks a reviewer handed out before reviewers' models
	// were recorded, whose record says so in words.
	ModelsUnrecorded bool `json:"models_unrecorded,omitempty"`
}

RecordVerdict is one verdict the loop recorded from a validator's return.

func (RecordVerdict) ModelsPhrase added in v0.17.0

func (v RecordVerdict) ModelsPhrase() string

ModelsPhrase names the writers' and the reviewer's models as the text surfaces show them, each cleaned, bounded and in a code span where it is shown; for a reviewer handed out before they were recorded, that they were not; "" when the verdict records none.

func (RecordVerdict) ReviewerPhrase added in v0.17.0

func (v RecordVerdict) ReviewerPhrase() string

ReviewerPhrase names the verdict's reviewer as the text surfaces show it: its index and its class with the model and effort the class held; "" for a validator no review set asked for a class.

type Refusal

type Refusal struct {
	// Stage is where the loop refused: "check" before a run starts, "state" for
	// a run that cannot be read, "pause" for the window clock, or the lane stage
	// ("worktree", "implement", …) and "receipt" inside a run.
	Stage string `json:"stage"`
	// Check names the pre-start check that failed, when Stage is "check".
	Check string `json:"check,omitempty"`
	// Lane names the lane, inside a run.
	Lane   string `json:"lane,omitempty"`
	Reason string `json:"reason"`
	Remedy string `json:"remedy"`
	// Contention marks a refusal that is somebody else's hold rather than the
	// caller's fault — a peer holding the record, a run locked by another
	// invocation, a pause: back off and take other work. The CLI maps it to
	// exit 3, as `abcd implement` does.
	Contention bool `json:"contention,omitempty"`
	// Wrote says what the call did before it refused, "" for nothing.
	Wrote string `json:"wrote,omitempty"`
	// Checks is every pre-start check's row, when Stage is "check", so a caller
	// sees the whole picture rather than the first failure.
	Checks []CheckRow `json:"checks,omitempty"`
	// Excluded is every planned intent a pick excluded and the check that
	// excluded it, when a pick found no candidate.
	Excluded []Excluded `json:"excluded,omitempty"`
	// Outage is the run's lost connection a refusal is held by: the shared
	// probe a lane waits on, or, at the stage "outage", the give-up with what
	// the run had done and what is left (iss-2610080620372731).
	Outage *OutageInfo `json:"outage,omitempty"`
	// contains filtered or unexported fields
}

Refusal is the one shape every refusal of the loop takes (criterion 13): the stage it happened at, the reason and the remedy, in text and in --json. A refusal writes nothing: the state file is as it was before the call, except for the time a landing began waiting for its full check (ruling DR6d-2), which the call that finds the wait writes once, whatever the call answers.

func AsRefusal

func AsRefusal(err error) (*Refusal, bool)

AsRefusal returns err's Refusal, if it carries one.

func (*Refusal) Error

func (r *Refusal) Error() string

Error renders the refusal as one line: stage, reason, remedy.

type Resolution added in v0.12.0

type Resolution struct {
	Issue   string `json:"issue"`
	Commit  string `json:"commit"`
	Note    string `json:"note"`
	Impact  string `json:"impact"`
	Grounds string `json:"grounds"`
}

Resolution is one capture a lane fixed: the issue, the lane's commit that fixed it, and what `abcd capture resolve` records — the note, the product impact and the grounds. The loop checks the shape and that the commit is one the receipt names; the capture store judges the rest when the landing resolves it.

type RestartAside added in v0.13.4

type RestartAside struct {
	RunID string    `json:"run_id"`
	Lane  string    `json:"lane"`
	At    time.Time `json:"at"`
	// Path is the aside's directory, relative to the checkout root.
	Path string `json:"path"`
	// Head is the lane's last commit, the one the patch applies to and the one
	// the fresh agent starts from.
	Head string `json:"head"`
	// Files are the paths the patch changes; empty when nothing was left
	// uncommitted, and Patch is then empty too.
	Files []string `json:"files"`
	Patch string   `json:"patch,omitempty"`
	// Why is WhyDied, or "agent yielded: NETWORK: <cmd>".
	Why string `json:"why"`
	// Receipt is the partial receipt copied aside, by its name there; empty
	// when the gone agent wrote none.
	Receipt string `json:"receipt,omitempty"`
}

RestartAside is what a restart saved aside, as aside.json holds it.

type RestartResult added in v0.13.4

type RestartResult struct {
	StepResult
	Aside RestartAside `json:"aside"`
}

RestartResult is what restartLane returns: the lane's step result, re-telling the implementer await, and the aside.

func RestartDrive added in v0.16.1

func RestartDrive(ctx context.Context, repoRoot, runID, laneID, yielded string, steps Stages, o Options, rs Runners) (RestartResult, error)

RestartDrive is restartLane under the run's routes (iss-2611012047534449): a re-told role routed to a runner, by the configuration or a --route, is started on its runner at once, as a held role is retried (runner_pause.go), rather than re-told to the host; one the runner fails to start pauses the lane. A --route for a role the restart does not re-tell is refused before anything is changed. With rs.Config nil, or in an auto-plan run, it is restartLane. The first routed role re-told is started; any other is retried by a later step.

type Retry added in v0.16.1

type Retry struct {
	Lane   string       `json:"lane"`
	Role   string       `json:"role"`
	Runner string       `json:"runner"`
	Why    string       `json:"why"`
	Paused *RunnerPause `json:"paused,omitempty"`
}

Retry is a held role a step retried on its runner: the lane, the role, the runner, why it was held, and, when the runner failed to start it again, the pause it stays in.

type ReviewClass added in v0.16.0

type ReviewClass struct {
	Class        string `json:"class"`
	Model        string `json:"model"`
	MapLayer     string `json:"map_layer"`
	MapOrigin    string `json:"map_origin"`
	Effort       string `json:"effort,omitempty"`
	EffortLayer  string `json:"effort_layer,omitempty"`
	EffortOrigin string `json:"effort_origin,omitempty"`
}

ReviewClass is one class of a review set with the model the class map resolves it to, and the map layer ("machine" or "bundled") and origin that supplied the model; and the effort the class runs at, with the layer and origin of models.effort that set it. A run started before efforts carries none of the three.

type ReviewJudge added in v0.16.0

type ReviewJudge struct {
	Class        string `json:"class"`
	Model        string `json:"model"`
	MapLayer     string `json:"map_layer"`
	MapOrigin    string `json:"map_origin"`
	Effort       string `json:"effort,omitempty"`
	EffortLayer  string `json:"effort_layer,omitempty"`
	EffortOrigin string `json:"effort_origin,omitempty"`
	Layer        string `json:"layer"`
	Origin       string `json:"origin"`
	Status       string `json:"status"`
}

ReviewJudge is a review set's judge: its class, the model it resolves to, the layer and origin of review.judge, and its status, fixed when the run starts (itd-2611101419006280 decision 5): active once a judge agent has cleared itd-81's calibration gate, else waiting. A waiting judge is never launched, awaited or counted in an estimate, and a run never gains a judge part-way.

func (*ReviewJudge) Active added in v0.17.0

func (j *ReviewJudge) Active() bool

Active reports whether the run's judge runs on a disagreement: a judge the run started with as active. nil, and a waiting judge, never run.

type ReviewRoute added in v0.14.2

type ReviewRoute struct {
	// Name is the route as oracle.review names it; the record names it.
	Name string
	// Reviewer reaches the route; nil when this machine names no server for
	// it, and Absent says so.
	Reviewer Reviewer
	Absent   string
	// AgentPrompt is a reviewer's agent definition, the head of its request.
	AgentPrompt func(role string) (string, error)
}

ReviewRoute is the reviewer route the configuration selected.

func LoadReviewRoute added in v0.14.2

func LoadReviewRoute(r layered.Roots, agentPrompt func(role string) (string, error)) (*ReviewRoute, error)

LoadReviewRoute reads the reviewer route (oracle.LoadReview) at the roots a step starts from and refuses in the loop's refusal shape on a fault, before anything moves. nil is the host's route: nothing differs from a run that configures none.

type ReviewSet added in v0.16.0

type ReviewSet struct {
	Roles        []RoleReviewers `json:"roles"`
	Judge        *ReviewJudge    `json:"judge"`
	MaxReviewers PaceValue       `json:"max_reviewers"`
	Classes      []ReviewClass   `json:"classes,omitempty"`
	Unlaunchable []RoleClasses   `json:"unlaunchable,omitempty"`
}

ReviewSet is a run's review set: each role's reviewers, the judge (nil for none) and the ceiling the lists were held to; and Classes, the whole class map the run started on, one entry per class in the order Classes gives, from which a reviewer whose class holds the writer's model takes another (reviewers.go). Classes is empty in a run started before version 27, which chooses among the classes its set recorded. Unlaunchable is, for a run a drive started, each role's classes of that map its runners could not launch when the run started, by the admission CheckReviewersLaunch asks of the listed reviewers, so a reviewer is never moved to one of them; empty when every class launches, and on every run but a drive's, whose reviewers are asked of the host.

func ReviewSetFor added in v0.17.0

func ReviewSetFor(o Options, repoRoot string) (ReviewSet, error)

ReviewSetFor is the review set a run started now would run on, as a drive's start names it before it asks (itd-2611101419006280 decision 8).

func (ReviewSet) ClassMapPhrase added in v0.17.0

func (rs ReviewSet) ClassMapPhrase() string

ClassMapPhrase is the class map the run started on as the text surfaces show it, each class with its model, and what a reviewer whose class holds a writer's model does; "" for a run started before the map was stored.

func (ReviewSet) Pair added in v0.17.0

func (rs ReviewSet) Pair() string

Pair is the set as a drive's start names it before it asks: each role's reviewers, the two roles together where they run the same classes, and the judge with its status.

func (ReviewSet) Role added in v0.16.0

func (rs ReviewSet) Role(role string) (RoleReviewers, bool)

Role returns the reviewers of role, and false when the set names none.

func (ReviewSet) String added in v0.16.0

func (rs ReviewSet) String() string

String renders the set and where each value came from, as the run record and the text surfaces name it.

type Reviewer added in v0.14.2

type Reviewer interface {
	Review(ctx context.Context, request string) (string, error)
}

Reviewer is the validator interface a reviewer route other than the host implements: the request the loop renders in, the reviewer's whole return out. The loop reads the verdict from the return and records it, as it does a host reviewer's. An error is a review that did not come back: one with a Reason method names the fallback's reason, and its text is the detail.

type RoleClasses added in v0.17.0

type RoleClasses struct {
	Role    string   `json:"role"`
	Classes []string `json:"classes"`
}

RoleClasses is one review role's classes a drive's runners could not launch when the run started, in the order Classes gives.

type RoleReviewers added in v0.16.0

type RoleReviewers struct {
	Role      string        `json:"role"`
	Reviewers []ReviewClass `json:"reviewers"`
	Layer     string        `json:"layer"`
	Origin    string        `json:"origin"`
	Clamped   int           `json:"clamped,omitempty"`
}

RoleReviewers is one role's reviewers, with the layer and origin of the list. Clamped is the length the list named before the machine's ceiling cut it; 0 when it was not cut.

type Round added in v0.16.0

type Round struct {
	Role string `json:"role"`
	// Tier is the tier the role was asked to run at, the receipt's tier asked;
	// "" when its route names no tier.
	Tier oracle.Tier `json:"tier,omitempty"`
	// EscalatedFrom is the tier the role ran at in the round before, when the
	// failed round moved it up; "" when it did not move.
	EscalatedFrom oracle.Tier `json:"escalated_from,omitempty"`
	// GateOutput is the failing output of the round before this role ran, the
	// verdicts and findings that caused any switch, bounded; "" when the role
	// did not follow a failed round.
	GateOutput string `json:"gate_output,omitempty"`
	// Note says why the role did not move after a failed round: its route
	// names no tier, or it is at the top of the ladder.
	Note string `json:"note,omitempty"`
}

Round is the route one role of a lane's round ran at (spc-2609251028149555, AC 10; itd-2609170822093401's Decision 1, "a rule, not a router"). A round whose gates failed moves the next round's tier one step up the ladder local, economy, frontier (oracle.Escalate), and the switch is recorded here as a fact: the tier the role ran at, the tier it moved from, and the failing gate output that caused it. A route that names no tier (a runner and model, a role pointed at a provider, host-decides, or a role with no routing row) does not move, and says why in Note.

type RoundJudge

type RoundJudge struct {
	Roles  []string `json:"roles"`
	Class  string   `json:"class"`
	Model  string   `json:"model"`
	Effort string   `json:"effort,omitempty"`
	Brief  string   `json:"brief,omitempty"`
	Return string   `json:"return,omitempty"`
	Ruled  bool     `json:"ruled,omitempty"`
	Struck int      `json:"struck,omitempty"`
	// Strikes are the locations the judge struck, each with its reason, in
	// the round's validator order: kept on the judge, so they outlive the
	// round's findings, which the state drops once the next round opens
	// (keepLatestFindings). A judge an abcd before state version 29 recorded
	// keeps none where its round's findings were already dropped, and one
	// whose strikes were trimmed to keep the state within its bound keeps
	// none either (trimOldestFindings); its count stands in both.
	Strikes    []JudgeStrike `json:"strikes,omitempty"`
	Unlaunched string        `json:"unlaunched,omitempty"`
}

RoundJudge is a round's judge: the roles whose reviewers disagreed, in the order the round hands them out; the class, model and effort the run's judge resolved to; its brief and return; whether the loop recorded its return (Ruled), how many locations it struck and each with its reason (Strikes); or, where the run's active judge was not launched because its agent no longer cleared the gate, why (Unlaunched), with no brief or return.

func (RoundJudge) ClassPhrase

func (j RoundJudge) ClassPhrase() string

ClassPhrase names the judge's class as the text surfaces show it, with the model it held and the effort it ran at.

type RouteAnswer added in v0.14.2

type RouteAnswer struct {
	Route  string `json:"route"`
	SHA256 string `json:"sha256"`
}

RouteAnswer is the answer a reviewer route placed at an await's return path: the route, and the SHA-256 (hex) of the bytes it placed. The receipt records the review as the route's only when the return its verifier reads has that digest.

type RoutedJudgementAnswer added in v0.15.1

type RoutedJudgementAnswer struct {
	SchemaVersion int    `json:"schema_version"`
	Issue         string `json:"issue"`
	Answer        string `json:"answer"`
	Kind          string `json:"kind,omitempty"`
	Reason        string `json:"reason"`
}

RoutedJudgementAnswer is the routed judge's answer, read strictly: the host's shape less the digest, which abcd computes itself.

type RunPick added in v0.12.0

type RunPick struct {
	// Lane is the lane whose branch carries the pick's entry as its first
	// commit: the run's first lane.
	Lane string `json:"lane"`
	// Entry is the grounds entry's text, written after the `pursued:` token.
	Entry string `json:"entry"`
	// Pick is the choice: the candidates in the pick order with their scores,
	// the rule, the runner-up.
	Pick intent.Pick `json:"pick"`
	// Excluded are the planned intents the checks excluded.
	Excluded []Excluded `json:"excluded"`
}

RunPick is the pick a run was started from, as the state carries it.

type RunRecord added in v0.12.0

type RunRecord struct {
	RunID  string `json:"run_id"`
	Key    string `json:"key"`
	Intent string `json:"intent"`
	Spec   string `json:"spec"`
	Driver Driver `json:"driver"`
	// Profile names the profile a drive ran the run on, by name; absent for a run no
	// drive named one for.
	Profile   string    `json:"profile,omitempty"`
	Complete  bool      `json:"complete"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	// Pace is the pace the run ran on, nil for a run started before the loop
	// paced a run.
	Pace *Pace `json:"pace"`
	// Review is the review set the run ran on, nil for a run started before
	// review sets.
	Review      *ReviewSet    `json:"review"`
	Lanes       []RecordLane  `json:"lanes"`
	Pending     []PendingStep `json:"pending"`
	Transcripts []Transcript  `json:"transcripts"`
	// Fallbacks are the run's fallback receipts, and FallbackCounts their
	// count per runner asked for and per role (itd-2609201916056194
	// criterion 4).
	Fallbacks      []runner.FallbackReceipt `json:"fallbacks"`
	FallbackCounts runner.Counts            `json:"fallback_counts"`
	// Outages are the lost connections the shared run's log records over the
	// run's lifetime, each with its minutes, its outcome and what was retried,
	// so a short outage nobody was told of still appears.
	Outages []implement.OutageSpan `json:"outages"`
	// Pick is the pick `abcd build next` started the run from, with its score
	// table and whether its falsifier was met; nil for a run `abcd build
	// <itd-N>` started.
	Pick   *RecordPick `json:"pick"`
	Record []Entry     `json:"record"`
}

RunRecord is a run's record as it is read at the end.

func CaptureTranscripts added in v0.12.0

func CaptureTranscripts(repoRoot, runID string, paths []string, capture TranscriptCapturer, o Options) (RunRecord, error)

CaptureTranscripts captures each path into the history store through capture, one capture per path, and records each in the run's state. It is refused on a run that is not complete: the record's transcripts are the run's, captured at its end. A capture that fails stops the call: the ones before it are recorded, and the refusal names the path that failed, so the call can be made again with the rest. A path captured before is captured again (the store's capture is idempotent) and recorded once. A session that is not the run's driver leaves a run whose file states another version as it stands, capturing nothing (mayWholeSave): `implement record` makes no claim.

func ReadRecord added in v0.12.0

func ReadRecord(repoRoot, runID string) (RunRecord, error)

ReadRecord reads a run's record.

type RunRenewal added in v0.16.0

type RunRenewal struct {
	// Root is the checkout the run lives in.
	Root string
	// RunID and Key name the run and the record it reserves.
	RunID string
	Key   string
	// Renewed is true for a renewal pushed and logged as reservation_renewed;
	// in a run with members, only when no issue's renewal in the pass failed
	// (membersRenewal).
	Renewed bool
	// Note is what the run record logged: the renewal's line when Renewed,
	// else why it failed, or that the reservation is another person's or
	// copy's.
	Note string
}

RunRenewal is one renewal of a run's reservation RenewRuns or RenewRunsIn made or tried.

func RenewRuns added in v0.16.0

func RenewRuns(waiterRoot string, now time.Time) []RunRenewal

RenewRuns renews, as at now, the due reservation of each run in progress the gated waiter in waiterRoot serves: each that lives in waiterRoot, and each that lives in another worktree of the repository (git worktree list) with a lane, not yet done, whose worktree is waiterRoot, compared by real path. A run that cannot be read is named in the result and not renewed, and the others in its worktree still are; a worktree that cannot be listed, and a listing git refuses, renew nothing. It never refuses: the waiter's wait and its command go on whatever it finds.

func RenewRunsIn added in v0.16.0

func RenewRunsIn(repoRoot, runID string, now time.Time) []RunRenewal

RenewRunsIn renews, as at now, the due reservation of each run in progress that lives in repoRoot, or of the one runID names ("" for every run): implement status's renewal of the runs it shows.

type RunStop added in v0.16.2

type RunStop struct {
	SetBy   string    `json:"set_by"`
	SetAt   time.Time `json:"set_at"`
	NotedAt time.Time `json:"noted_at"`
	// HaltedAt is when the last lane settled and the claims were let go; nil
	// while an agent is still in its call.
	HaltedAt *time.Time `json:"halted_at,omitempty"`
	// Released says what became of the run's reservation.
	Released string     `json:"released,omitempty"`
	Left     []StopLeft `json:"left,omitempty"`
	// FromFile says the stop was read from a stop file, which a lift removes; a
	// signal's stop has none, and stays until a take-over.
	FromFile bool `json:"from_file,omitempty"`
	// PageFailed says why the day's page could not be written, "" when it could.
	PageFailed string `json:"page_failed,omitempty"`
}

RunStop is the stop a run took: who set it and when, what is left of the halting, and what each lane left once it settled.

type RunnerClaim added in v0.16.1

type RunnerClaim struct {
	Runner  string    `json:"runner"`
	Session string    `json:"session"`
	Until   time.Time `json:"until"`
}

RunnerClaim is a runner a step started for an await: the runner, the session it was started under, and when the claim lapses.

type RunnerPause added in v0.16.1

type RunnerPause struct {
	Runner string        `json:"runner"`
	Reason runner.Reason `json:"reason"`
	Detail string        `json:"detail"`
	// Stderr is the first line the runner wrote to stderr, redacted, one line
	// and bounded; "" when it wrote none.
	Stderr string    `json:"stderr,omitempty"`
	Since  time.Time `json:"since"`
	At     time.Time `json:"at"`
	Tries  int       `json:"tries"`
}

RunnerPause is why a role waits for its runner: the runner that failed to start it, the reason in abcd's words, the first line the runner wrote to stderr, when the pause began and when the latest start failed, and how many starts have failed.

func (RunnerPause) Why added in v0.16.1

func (p RunnerPause) Why() string

Why is the pause's reason as one clause.

type Runners added in v0.12.0

type Runners struct {
	// Config is the runner configuration read when the call began
	// (runner.Load); nil drives nothing and leaves every role on the host.
	Config *runner.Config
	// Transcripts is where each runner's transcript lands: abcd's own store
	// (runner.HistoryStore) in production.
	Transcripts runner.TranscriptStore
	// Timeout bounds one runner's run; the role's Config.TimeoutFor when zero.
	Timeout time.Duration
}

Runners is what the process driver starts a routed role through.

type SeriesFlags added in v0.14.0

type SeriesFlags struct {
	Pace      *string `json:"pace,omitempty"`
	SubAgents *string `json:"sub_agents,omitempty"`
	FixRounds *string `json:"fix_rounds,omitempty"`
}

SeriesFlags are --pace, --sub-agents and --fix-rounds as typed; absent when not given.

type SeriesPick added in v0.14.0

type SeriesPick struct {
	Intent   string    `json:"intent"`
	RunID    string    `json:"run_id"`
	PickedAt time.Time `json:"picked_at"`
	Outcome  string    `json:"outcome"`
	// Falsified is true once the run's state met the pick's falsifier.
	Falsified bool `json:"falsified"`
}

SeriesPick is one pick of a series and what its run has come to.

type SeriesResult added in v0.14.0

type SeriesResult struct {
	// State is the series' state file, relative to the checkout root.
	State string `json:"state"`
	// Started is true when this call began the series.
	Started bool `json:"started"`
	NextSeries
	Complete bool `json:"complete"`
}

SeriesResult is the series as one call leaves it.

type Stage added in v0.12.0

type Stage string

Stage is one stage of a lane: the loop performs a lane's stages in order, and the lane as a whole lands one step of the spec (a spec's steps keep that word; BU1, iss-2609291313276243).

const (
	StagePlanReview Stage = "plan-review"
	StagePlan       Stage = "plan"
)

The auto-plan lane's stages.

const (
	StageWorktree  Stage = "worktree"
	StageBrief     Stage = "brief"
	StageImplement Stage = "implement"
	StageValidate  Stage = "validate"
	StageLand      Stage = "land"
	StageDone      Stage = "done"
	// StageHandedBack is a lane that took its run's cap of fix rounds and still
	// did not pass (itd-50, criterion 2): the loop starts nothing further for
	// it, and its intent is the person's to replan.
	StageHandedBack Stage = "handed-back"
	// StageHeld is a lane whose round passed after a sibling was handed back
	// (ruling DR6c): it holds no slot, starts nothing and is never armed until
	// the person releases it (`implement step --release`) or discards it.
	StageHeld Stage = "held"
	// StageDiscarded is a held lane the person discarded: its pull request
	// closed, its worktree and branch removed, its step left unlanded.
	StageDiscarded Stage = "discarded"
)

The lane's stages, in the order Sequence performs them. StageDone is the state of a lane with nothing left to do, and StageHandedBack of a lane stopped and handed back to the person; neither is a stage with a body.

type StageDef added in v0.12.0

type StageDef struct {
	Name    Stage
	Piece   int
	Run     Handler
	Verify  Verifier
	Repeats bool
}

StageDef is one stage of the lane sequence: its name, the spec piece that delivers its body, and the body — nil when this build does not carry it.

A stage that hands the lane to several agents in turn (the validators, and the fresh implementer their findings go to) sets Repeats: a verified receipt then returns the lane to the stage's body rather than completing the stage, and the body decides, on the next step, whom it hands the lane to next or that the stage is complete.

type Stages added in v0.12.0

type Stages []StageDef

Stages is the lane sequence with its bodies.

func DefaultStages added in v0.12.0

func DefaultStages() Stages

DefaultStages is the lane sequence this build carries, each stage with the spec piece that delivers its body: the worktree (lane.go), the brief (brief.go), the implement stage with its receipt's verifier (receipt.go) and the validators with theirs (validate.go), and the landing (land.go).

type StartResult

type StartResult struct {
	RunID string `json:"run_id"`
	// State is the state file, relative to the checkout root.
	State string `json:"state"`
	// Resumed is true when a live run for the key already existed: the call
	// created nothing and names that run.
	Resumed bool          `json:"resumed"`
	Lane    Lane          `json:"lane"`
	Pending []PendingStep `json:"pending"`
	// Checks are the pre-start checks' rows when the call created the run; a
	// resumed start runs none, and carries none.
	Checks []CheckRow `json:"checks"`
	// Claim is the shared-run claim a new run took for Options.Session; nil when
	// no session was named or the start resumed a run, and then null in the
	// JSON, never absent, so the payload says the run holds no claim.
	Claim *implement.ClaimResult `json:"claim"`
	// Pace is the run's pace, each number with the layer that supplied it.
	// Null for a run started before the loop paced a run.
	Pace *Pace `json:"pace"`
	// Review is the run's review set (reviewset.go), each value with the
	// layer that supplied it. Null for a run started before review sets.
	Review *ReviewSet `json:"review"`
	// Diagnostics are the review set's non-fatal reports when the call
	// created the run (a list clamped to the machine's ceiling, a
	// repository's class map skipped), one line each, for the front door to
	// print on stderr; never in the payload.
	Diagnostics []string `json:"-"`
	// HandBack is set when the run's lane stands handed back to the person.
	HandBack *HandBack `json:"hand_back,omitempty"`
	// Reservation is what the start did with the run's reservation on the
	// shared remote (reserved, renewed or took it over, until when, with what
	// footprint); empty when it reserved nothing (no remote named origin, or
	// a resumed run handed back).
	Reservation string `json:"reservation,omitempty"`
	// ReservationWarnings is each warning the start's reservation act gave:
	// a footprint path naming a directory git tracks, with the tracked files
	// beneath it (iss-2610230016544142), reserved all the same. Every act
	// that names the run's footprint gives them, a reserve that renews this
	// copy's own tip included; it is empty when the footprint names no such
	// directory, when a resume renewed the reservation keeping the tip's
	// footprint (a renewal names none), or when nothing was reserved.
	ReservationWarnings []string `json:"reservation_warnings,omitempty"`
	// ForkUnchecked is why the start's reservation could not ask the forge
	// whether origin is a fork, so it went on without the check (claim's
	// Result.ForkUnchecked); "" when it asked, or asked nothing.
	ForkUnchecked string `json:"fork_unchecked,omitempty"`
	// ForkAllowed is the fork, as owner/name, the start's reservation was let
	// through on because reservation.fork_origin names it (claim's
	// Result.ForkAllowed); "" when none was.
	ForkAllowed string `json:"fork_allowed,omitempty"`
	// Closed is each lane a resumed build closed because its pull request had
	// merged (closeOnResume); empty when it closed none.
	Closed []ClosedLane `json:"closed,omitempty"`
	// Finished is true when that closing left the run nothing to build: the
	// run is complete, and the invocation started nothing more.
	Finished bool   `json:"finished,omitempty"`
	Next     string `json:"next"`
}

StartResult is what Start returns.

func Start

func Start(repoRoot, key string, o Options) (StartResult, error)

Start resumes the live run for key, or runs the checks and, when every one passes and the budget check (budget.go) finds no runner's quota under the run's estimate, creates the run: the state file with one lane at the sequence's first stage, the spec's other unlanded steps pending, and the record's first line. A refused check writes nothing.

A live run for the same key in this checkout is looked up first, under the lock, and resumed — named, not duplicated, and not re-judged. The checks judged the record when the run was created; since then the run's own lanes change the tree they read (a lane's worktree moves the intent to shipped/, a lane claims it), so judging again would refuse the run as its own peer. So starting again after a kill loses nothing and repeats nothing, and the checks run only when a run is created. Only the key's shape is checked before the lookup, so a path is never built from a key that is not an intent id.

With o.Session named, a new run also claims its intent in the shared run state for that session, with the run id as the lane and the longest lease a claim takes: the peers check then counts that session's own live claim on the intent as its own, and a build from another checkout counts it as a peer's. A session that has not joined is refused before anything is created; a claim refused under the lock (a racing holder, a second session's bound) leaves no run behind; and a run whose state cannot be written releases the claim it took.

type State

type State struct {
	SchemaVersion int `json:"schema_version"`
	// RunID names the run and its directory.
	RunID string `json:"run_id"`
	// Key is the record the run was started for: an intent id, or an issue id
	// (decision 10), for which Intent and Spec are empty.
	Key string `json:"key"`
	// Intent and Spec are the intent the run delivers and the open spec it
	// builds against, as the readiness gate judged them.
	Intent string `json:"intent"`
	Spec   string `json:"spec"`
	// Driver is what drives the loop (DriverHost unless configured).
	Driver Driver `json:"driver"`
	// Profile names the profile a drive runs this run on (drive_profile.go), "" for
	// a run no drive has driven.
	Profile   string    `json:"profile,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	// WindowStartedAt and NextEligibleAt are the window clock the pacing intent
	// (itd-2609201925079472) writes and reads. The loop honours NextEligibleAt:
	// before it, a stage is refused as a pause and nothing moves (decision 2).
	WindowStartedAt *time.Time `json:"window_started_at,omitempty"`
	NextEligibleAt  *time.Time `json:"next_eligible_at,omitempty"`
	// Pace is the pace the run started on, each number with the layer that
	// supplied it (itd-2609201925079472). Nil in a run a version-1 state file
	// holds: it started before the loop paced a run, and runs unpaced.
	Pace *Pace `json:"pace,omitempty"`
	// Review is the review set the run started on (reviewset.go), each value
	// with the layer that supplied it. Nil in a run a state file before
	// version 15 holds: it started before review sets.
	Review *ReviewSet `json:"review,omitempty"`
	// Pick is the pick `abcd build next` made to start the run: the
	// candidates, their scores and the grounds entry its first lane commits.
	// Nil for a run `abcd build <itd-N>` started.
	Pick *RunPick `json:"pick,omitempty"`
	// Admitted is the rule the run's lanes were admitted under
	// (itd-2610301850454860): the drain's rule record, with its path, for a lane
	// the drain opened, else the spec the run builds against or the issue it
	// fixes. Written at the start; every records commit carries it as its
	// `Admitted-by:` trailer, and a records step over a state without it is
	// refused. Nil in a run a state file before version 26 holds, and in the
	// two runs that land nothing: an auto-plan run, which plans a draft, and a
	// trial run.
	Admitted *Admitted `json:"admitted,omitempty"`
	// Lanes are the lanes opened so far, in the order they opened; several may
	// be open at once, up to the ceiling (ruling DR6). A lane lands one step of
	// the spec's `## Steps` (the whole spec when it lists none).
	Lanes []Lane `json:"lanes"`
	// Waiting is the work the ceiling holds back: each item's lane, role and
	// the time the ceiling first held it. An item leaves it when it takes a
	// slot, with a record entry naming the minutes it waited.
	Waiting []Waiting `json:"waiting,omitempty"`
	// Pending are the spec's unlanded steps no lane has been opened for yet.
	Pending []PendingStep `json:"pending"`
	// Record is the run record, accumulated as stages complete.
	Record []Entry `json:"record"`
	// Transcripts are the transcripts the run's record captured into the
	// history store once the run was complete, one capture per path (piece 10).
	Transcripts []Transcript `json:"transcripts,omitempty"`
	// Fallbacks are the run's fallback receipts, one per role a runner it was
	// routed to did not run (itd-2609201916056194 criterion 3): the role, the
	// runner asked for, the reason and the route that ran instead. The run's
	// summary counts them per runner and per role (runner.Tally).
	Fallbacks []runner.FallbackReceipt `json:"fallbacks,omitempty"`
	// ReservedAt is when the run reserved its key on the shared remote
	// (itd-2609091034175565): the reservation `implement step` renews, fences
	// and tombstones. Nil for a run that holds none.
	ReservedAt *time.Time `json:"reserved_at,omitempty"`
	// Bundle is the member issues an issue run carries beside its lead, the
	// run's Key (itd-2611201450052326): one lane, one branch and one pull
	// request for them all, each member keeping its own reservation. Empty for
	// a run with no members, which writes no `bundle` key.
	Bundle []Member `json:"bundle,omitempty"`
	// LeadHandBack is the lead's own hand-back in a run with members, set when
	// the lead alone is handed back while its members go on: the lead is then
	// no issue of the run's (Issues). Nil on every other run.
	LeadHandBack *HandBack `json:"lead_hand_back,omitempty"`
	// Trial is set on a run started in the loop's trial mode (trial.go): a
	// model-matrix copy, which holds no reservation and lands nothing.
	Trial bool `json:"trial,omitempty"`
	// Frozen is a trial's frozen commit (Options.Frozen), which its lanes are
	// cut from; "" on every other run.
	Frozen string `json:"frozen,omitempty"`
	// contains filtered or unexported fields
}

State is one run: everything the loop needs between two invocations.

func ReadState

func ReadState(repoRoot, runID string) (State, error)

ReadState is the state file's one reader. It refuses a run id of the wrong shape before building a path from it, reads through the checkout's os.Root (so a symlinked component cannot walk the read out of the checkout), decodes strictly — an unknown field is a file some other writer produced — and holds the file to the version and the id it is stored under.

func Runs

func Runs(repoRoot string) ([]State, error)

Runs lists this checkout's runs, oldest first. An absent tier or run directory holds none. A state file that cannot be read fails the listing, naming it: a run the loop cannot read is not one it may skip past.

func (State) Ceiling added in v0.13.0

func (s State) Ceiling() int

Ceiling is the most agents the run may have out at once.

func (State) Complete

func (s State) Complete() bool

Complete reports whether the run has nothing left: every lane is done (or, in an issue run, discarded) and no spec step is waiting for one.

func (State) FixRoundCap added in v0.12.0

func (s State) FixRoundCap() int

FixRoundCap is the fix rounds a lane of the run may take before it is handed back: the run's own, or the bundled value for a run that started before the pace carried one (an unpaced run, or a state file before version 6).

func (State) Issue added in v0.12.0

func (s State) Issue() string

Issue is the issue an issue-keyed run fixes (decision 10), or "" for a run that builds an intent.

func (State) Issues

func (s State) Issues() []string

Issues is every issue of the run, in order: the lead, then each member, leaving out each handed back alone, the lead included. A run with no members is its key alone, which every reservation act iterates as it reads the one key today.

func (State) SlotsInUse added in v0.13.0

func (s State) SlotsInUse() int

SlotsInUse is the agents the run has out: its outstanding awaits.

type StepResult

type StepResult struct {
	RunID string `json:"run_id"`
	Lane  string `json:"lane,omitempty"`
	// PerformedStage is the stage this call completed; empty when it completed none
	// (the lane awaits a receipt, or the run is complete).
	PerformedStage Stage `json:"performed_stage,omitempty"`
	// Stage is the lane's next stage after the call.
	Stage Stage `json:"stage,omitempty"`
	// Awaiting is what the lane waits on, when it waits on an agent.
	Awaiting *Await `json:"awaiting,omitempty"`
	// Tier is the model tier the round asks the awaited agent to run at
	// (escalate.go), one step up after a round that did not pass; omitted
	// when its route names no tier.
	Tier     oracle.Tier `json:"tier,omitempty"`
	Complete bool        `json:"complete"`
	// NextEligibleAt is set when this call closed the run's window: nothing
	// was performed, and no stage is taken before this time.
	NextEligibleAt *time.Time `json:"next_eligible_at,omitempty"`
	// HandBack is set when the lane was handed back to the person: this call
	// stopped it, or it stood stopped when the run was started again.
	HandBack *HandBack `json:"hand_back,omitempty"`
	// Slots is the agents the run has out after the call, and Ceiling the most
	// it may have (the run's pace.sub_agents); CeilingReached is set when this
	// call found every slot taken and handed nothing out.
	Slots          int  `json:"slots"`
	Ceiling        int  `json:"ceiling"`
	CeilingReached bool `json:"ceiling_reached,omitempty"`
	// Alive is every lane of the run with anything left, with its stage and
	// each agent it awaits, the held lanes included.
	Alive []AliveLane `json:"alive,omitempty"`
	// Blocked are the landings that waited on the forge's merge this call
	// while another lane moved: each holds only its own lane. Any other refused
	// stage is the call's answer, and no lane moves.
	Blocked []Refusal `json:"blocked,omitempty"`
	// Route is the route that ran the agent when the process driver started
	// it through a runner (Drive); absent when the host is to run it.
	Route *runner.RouteRecord `json:"route,omitempty"`
	// Fallback is the fallback receipt this call recorded when the reviewer
	// route did not return a review and the host is handed it.
	Fallback *runner.FallbackReceipt `json:"fallback,omitempty"`
	// Paused is the lane's role its runner failed to start, with why
	// (Await.Paused): it waits for the runner, and no agent is to be started
	// for it (runner_pause.go). Awaiting is then empty.
	Paused *Await `json:"paused,omitempty"`
	// Retried is the held role this call retried on its runner, with why it
	// was held and, when the runner did not start it again, its pause.
	Retried *Retry `json:"retried,omitempty"`
	// Outage is the run's lost connection while one is open: the lanes that
	// reach the network or an agent wait on its shared probe (Blocked names
	// them) while the others move.
	Outage *OutageInfo `json:"outage,omitempty"`
	// RateLimit is the runner's rate-limit response that ended the run's
	// window early in this call, with the lanes it checkpointed
	// (ratelimit.go); NextEligibleAt is then the pause's end.
	RateLimit *RateLimit `json:"rate_limit,omitempty"`
	// AcceptedConfigChange names each changed git setting or file the call
	// accepted (`implement step --accept-config-change`) before its step:
	// names alone, a URL subsection hidden, never a value (configwatch.go).
	AcceptedConfigChange []string `json:"accepted_config_change,omitempty"`
	// Bundle is where a discard saved the lane's commits not on origin's
	// default branch before it removed the lane's branch, relative to the
	// checkout root; "" when the branch held none of its own.
	Bundle string `json:"bundle,omitempty"`
	// Released is what became of the run's reservation once a discard left no
	// lane of the run at work or held; "" when it held none to release.
	Released string `json:"released,omitempty"`

	// RouteUnused is each `implement step --route` the step did not use: a
	// landing ahead of its role moved first (route_use.go). Every other
	// --route the step would not use is refused before anything is written.
	RouteUnused []string `json:"route_unused,omitempty"`
	Next        string   `json:"next"`
	// contains filtered or unexported fields
}

StepResult is what advance and Receipt return.

func Discard added in v0.13.0

func Discard(repoRoot, runID, laneID string, o Options) (StepResult, error)

Discard does not land a held lane, on the person's word (`implement step --discard <lane>`): its worktree is removed from the machine store and its branch deleted, then its pull request is closed if it opened one, and its stage is `discarded`; its step stays unlanded in the spec, so a replanned remainder carries it. The local removals come first, so a refused one leaves the pull request open and the lane held, and a retry finds nothing half done: a worktree or branch already gone is passed over. It changes nothing when the lane is not held or any lane is still at work.

It also ends a lane at work whose run nothing drives, and a lane handed back for any reason (discard_unheld.go): refused while the run is live or the lane's pull request is open or merged, its worktree and branch are removed as a held lane's are, and a pull request the forge reports closed is not closed again. Every discard first saves the lane's commits not on the default branch to a bundle in the run's directory (saveLaneBundle), and one that leaves no lane of the run at work or held releases the run's reservation (releaseOnDiscard). With o.AcceptConfig, a changed git configuration is accepted in the discard's own write (acceptWith).

While the network is down a lane with a pull request to close waits on the shared probe, changing nothing, and a close the network refuses is recorded as the run's outage (outage.go).

func Drive added in v0.12.0

func Drive(ctx context.Context, repoRoot, runID string, steps Stages, o Options, rs Runners) (StepResult, error)

Drive performs the next stage as advance does and, when the stage hands the lane to an agent whose role is routed to a runner, starts that agent through the runner and hands its receipt back through Receipt. A role on the host returns the await for the host to act on, as advance returns it; a runner that did not start its role pauses the lane, and the result names the role as paused (runner_pause.go). A step that hands no agent out retries one held role once on its runner, and a --route for a held role retries it at once.

func DriveReview added in v0.14.2

func DriveReview(ctx context.Context, repoRoot, runID string, res StepResult, steps Stages, o Options, rr *ReviewRoute) (StepResult, error)

DriveReview sends the review this call handed to the host to rr instead: a ruthless or security reviewer res hands out, which no runner ran or fell back from. The route's return is written to the review's return path and handed back through the receipt, which verifies it and records its verdict with the route that ran it. Anything else, and a nil rr, is res unchanged.

A review the route does not return falls back (scope 3): no server on this machine, a refused connection, a bound run out, the server's error, an answer that is not the protocol's, or a return with no verdict the loop can record. The host's own agent is handed the same brief and return path, as res already names them, and one fallback receipt (the role, the route asked for, the reason and abcd's detail, the host as the route that runs it) is written to the run's state and record, which the summary counts per route and per role. No return is written for it, so nothing stands where the host's agent writes. A step interrupted while the route works (the person, or a host's command timeout) falls back too, as interrupted, so every review the route was asked for and did not return has its receipt.

func Receipt

func Receipt(repoRoot, runID, receiptPath string, steps Stages, o Options) (StepResult, error)

Receipt hands back the receipt an agent stage waited on. The path is looked up among every outstanding await of the run, not only one lane's, and the lane that await belongs to is advanced (ruling DR6): a verified receipt frees its slot, which the next `implement step` fills. It is refused when no await names the path, when this build carries no verifier for the stage, and when the verifier refuses it; in every refusal the run stays where it was and the agent's slot stays taken. A path a step already collected is the one exception to the first (answerCollected).

func Release added in v0.13.0

func Release(repoRoot, runID, laneID string, o Options) (StepResult, error)

Release lands a held lane as it is, on the person's word (`implement step --release <lane>`): its stage returns to `land` and its landing resumes at the step it stopped before, synced first when a sibling landed since its base. It changes nothing when the lane is not held or any lane is still at work.

type StopLeft added in v0.16.2

type StopLeft struct {
	Lane  string `json:"lane"`
	Stage Stage  `json:"stage"`
	// Settled is false while the lane's agent is still in its call.
	Settled bool `json:"settled"`
	// Aside is where its uncommitted work was saved, and Files how many files
	// that holds.
	Aside string `json:"aside,omitempty"`
	Files int    `json:"files,omitempty"`
	// Note says anything else: a receipt collected, an agent lost, work that
	// could not be saved.
	Note string `json:"note,omitempty"`
	// ArmedPR is the pull request armed before the stop, which the forge can still merge
	// under it, 0 when there is none.
	ArmedPR int `json:"armed_pr,omitempty"`
}

StopLeft is what the stop left in one lane.

type Sync added in v0.13.0

type Sync struct {
	At         time.Time `json:"at"`
	Siblings   []string  `json:"siblings"`
	Merged     string    `json:"merged"`
	Conflicted bool      `json:"conflicted"`
	Paths      []string  `json:"paths,omitempty"`
	Brief      string    `json:"brief,omitempty"`
	Receipt    string    `json:"receipt,omitempty"`
	// Head is the head the sync produced: the merge commit, or the verified
	// head of the implementer who resolved the conflict; empty until then.
	Head string `json:"head,omitempty"`
	// Round is the fresh round that judges Head, once it has opened.
	Round int `json:"round,omitempty"`
}

Sync is one merge of the default branch into a lane after a sibling lane of the run landed (spc-2609202134341288, "Two lanes that touch the same files"): the siblings whose landing caused it, the default branch's sha merged in, whether it conflicted, and the head it produced. A conflicting sync goes to a fresh implementer with the brief and receipt named here.

type TakeResult added in v0.16.2

type TakeResult struct {
	RunID string `json:"run_id"`
	// Profile names the profile a drive ran the run on, "" for none.
	Profile string `json:"profile,omitempty"`
	// Collected are the receipts it handed back, by lane.
	Collected map[string]string `json:"collected,omitempty"`
	// Saved are the lanes with no agent whose uncommitted work it saved aside.
	Saved []RestartAside `json:"saved,omitempty"`
	// Restarted are the lanes whose lost agents it re-told, with the aside each
	// saved; each await named there wants a fresh agent.
	Restarted []RestartResult `json:"restarted,omitempty"`
	// Left says what it could not do, and why.
	Left []string `json:"left,omitempty"`
	// Reservation is what became of a reservation a stop released.
	Reservation string `json:"reservation,omitempty"`
	// Run is the run as it now stands.
	Run  *ListedRun `json:"run,omitempty"`
	Next string     `json:"next"`
}

TakeResult is what a take-over did.

func TakeRun added in v0.16.2

func TakeRun(repoRoot, runID string, o Options) (TakeResult, error)

TakeRun takes a run over. It is refused, changing nothing, while a stop holds and while another driver's process is alive; and, having collected what had already arrived and changing nothing else, when a reservation a stop released cannot be taken again.

type TerminalOptions added in v0.16.2

type TerminalOptions struct {
	// Options are the loop's seams and configuration, Runners among them.
	Options Options
	// Drain are the drain's own flags; Context is set to the run's.
	Drain DrainOptions
	// Runners starts each role.
	Runners Runners
	// Stages are the lane's stages; DefaultStages when nil.
	Stages Stages
	// Review is the reviewer route, as `implement step` hands it.
	Review *ReviewRoute
	// Preflight runs the repository's preflight behind the load gate in
	// checkout, the drive's own checkout of a lane's head, whose full commit
	// id is head (preflightcheckout.go), never the lane's worktree.
	Preflight func(ctx context.Context, checkout, head string) error
	// PreflightAllowed says whether a lane's preflight may run, given its
	// worktree, base and head: the head its landing lands, the judged head or
	// the landing's records commit on it, never what the worktree has checked
	// out. A *PreflightRefused hands the lane back. Nil allows all.
	PreflightAllowed func(worktree, base, head string) error
	// Stop is closed when a stop is asked for. The context stays live, so a
	// call in flight finishes.
	Stop <-chan struct{}
	// BeforeStage is called before each move and each step, so before any
	// stage starts; an error ends the run, TerminalWall. Nil checks nothing.
	BeforeStage func() error
	// Resumed says this process goes on with a drive another began, so what that one
	// held back is this one's to report at its end.
	Resumed bool
	// BoundaryCeiling is the longest AtBoundary waits for what the run has in hand; past it
	// the call runs regardless. Zero sets none.
	BoundaryCeiling time.Duration
	// Moved is called after each move the drain makes, before anything else the run
	// does with it. Nil does nothing.
	Moved func()
	// AtBoundary is called once a move has been made and before the next, between stages
	// and with the checks above just passed: a lane has ended, or a wait has ended before
	// the next opens. A refused step comes back to the run with its lane still in progress
	// and reserved, and a judgement holds its issue, so the call stays due until the next
	// move has settled each, for BoundaryCeiling at most; past that it runs beside them,
	// and what the run holds is renewed while it does. It always waits for the next move to
	// take a skip the run gave. It is never called during a stage. It reports whether it
	// took time, so that the run goes round the stop, the bound and the checks again before
	// anything starts. Nil does nothing.
	AtBoundary func(ctx context.Context) bool
	// Say prints one line, already plain; nil says nothing.
	Say func(string)
	// Sleep waits; nil sleeps until the time passes or the stop or the
	// context ends it.
	Sleep func(ctx context.Context, d time.Duration)
	// Until is the bound the person set (--until): the run ends at this time,
	// and no wait ends it before then. Zero keeps the eight-hour limit on each
	// wait (adr-2610222222326104's amendment of 2026-11-05).
	Until time.Time
	// Probe asks whether a limit that named no reset has lifted, for role, with
	// the cheapest launch that can tell. It reports true when it has; otherwise
	// the failure says what came back. Nil leaves the lane's next launch to find
	// out.
	Probe func(ctx context.Context, role, model string) (bool, *runner.Failure)
}

TerminalOptions are one terminal run's inputs.

type TerminalResult added in v0.16.2

type TerminalResult struct {
	// Ended is why: the drain's Stopped, TerminalStopped or TerminalOutage.
	Ended string `json:"ended"`
	// Run, Issue and Lane name the lane left on its branch, when one is.
	Run   string `json:"run,omitempty"`
	Issue string `json:"issue,omitempty"`
	Lane  string `json:"lane,omitempty"`
	// Resume is the command that takes the lane up, when one is left.
	Resume string `json:"resume,omitempty"`
	// Lapses is when the lane's reservation lapses, when a kill left it held.
	Lapses *time.Time `json:"lapses,omitempty"`
	// Last is the last move's result.
	Last DrainResult `json:"last"`
	// HeldBack names each issue the run held back.
	HeldBack []string `json:"held_back,omitempty"`
	// PassedOver names each issue the run did not open, with why.
	PassedOver []Excluded `json:"passed_over,omitempty"`
	// PassedLanes names each lane the run passed over, with why.
	PassedLanes []PassedLane `json:"passed_lanes,omitempty"`
	// Why is what stopped the run when a check did.
	Why string `json:"why,omitempty"`
	// Swept is the line of the sweep the drive ran on its own at its end
	// (autosweep.go), "" when it ran none or it said nothing.
	Swept string `json:"swept,omitempty"`
}

TerminalResult is how one terminal run ended.

func RunTerminal added in v0.16.2

func RunTerminal(ctx context.Context, repoRoot string, o TerminalOptions) (TerminalResult, error)

RunTerminal drives the drain from here until its cap, an empty ledger, the outage limit or a stop. An error is a refusal the run cannot go past.

type Tiering added in v0.16.0

type Tiering struct {
	Table *oracle.Layered
	Conns oracle.Connections
	// Reviewer is the reviewer route oracle.review selects (ReviewRoute.Name),
	// which takes the ruthless and the security review the stage hands to the
	// host; "" when it selects none.
	Reviewer string
}

Tiering is the model-tier routing a step resolves each role's tier through: the routing tables (oracle.Load) and the machine's provider connections (oracle.APIConfig.Connections). A step with none records no route.

func LoadTiering added in v0.16.0

func LoadTiering(r layered.Roots, rr *ReviewRoute) (*Tiering, []string, error)

LoadTiering reads the model-tier routing a step resolves each role's tier through, at the roots a step starts from: the routing tables (oracle.Load) and the machine's provider connections (oracle.LoadAPI), with reviewer the reviewer route the step sends its reviews to (nil for none). A fault is refused in the loop's refusal shape before anything moves, as a delegating verb refuses it: the table decides which tier a round asks for, so it is never guessed past. The provider configuration's diagnostics and the tables' (an orphan row) are the caller's to print, as a delegating verb prints them.

type Transcript added in v0.12.0

type Transcript struct {
	At time.Time `json:"at"`
	// Path is the transcript as it was handed to the capture, home-redacted.
	Path string `json:"path"`
	// Session is the session the history store recorded it under, and Stored
	// where it lives there, home-redacted.
	Session string `json:"session"`
	Stored  string `json:"stored"`
	// Wrote is false when the store already held it (an idempotent capture).
	Wrote bool `json:"wrote"`
	// ScanGap is the capture's scan gap, home-redacted: the repository armed a
	// scanner augmenter (gitleaks) that did not run, so the transcript was
	// stored masked by the native scanner alone. Empty when there is none.
	ScanGap string `json:"scan_gap,omitempty"`
}

Transcript is one transcript the run record captured into the history store.

type TranscriptCapturer added in v0.12.0

type TranscriptCapturer func(path string) (Transcript, error)

TranscriptCapturer captures one transcript by path into the history store, as `abcd history capture <path>` does, and reports what it stored.

type Unattended added in v0.16.0

type Unattended struct {
	// Kind is UnattendedBuild or UnattendedDrain.
	Kind string
	// RunID and Key name a build's run and the record it builds; both are
	// empty for a drain. Key is empty too when the state names no record id
	// (an itd- or an iss- id): it is read from a local-tier file and quoted
	// to the agent, so nothing else is passed on.
	RunID string
	Key   string
}

Unattended is the build or drain a session's checkout is running.

func RunningUnattended added in v0.16.0

func RunningUnattended(sessionRoot string, now time.Time) (Unattended, bool, error)

RunningUnattended reports the build or drain running for the session whose checkout is sessionRoot, as of now. A build counts while its run is not complete and its state was written within lease.Default of now; a drain while it has not stopped and its state was written within the same window. The window is the reservation lease's: a run idle past it is the run the reservation system already treats as abandoned, so a checkout holding old unfinished runs (the main checkout keeps many from 2026-10-12) does not count as running one. A state dated more than lease.Skew ahead of now is not counted either, so a planted far-future date cannot hold it on. Nor is a run waiting on the person (waitsOnPerson): the person is at the terminal by then, taking the work over, and their own prompts must show.

The session also counts when sessionRoot is the worktree of a lane of a counting build in any other worktree of the same repository: a lane's checkout lives in the machine's worktree store, while its run's state lives in the checkout that started it.

A run or drain state that cannot be read does not count and is passed over. The error is returned only when nothing could be read: the checkout cannot be opened, or every state it holds failed and no lane matched. The caller reads an error as no answer, never as a run.

type ValidationRound added in v0.12.0

type ValidationRound struct {
	Round int `json:"round"`
	// ResolvesShown is each issue the round's brief named as declared fixed, as
	// the lane's receipts stood when it opened: what a records commit may move.
	ResolvesShown []string `json:"resolves_shown,omitempty"`
	// HeadSHA is the lane's head the round's validators judge.
	HeadSHA    string         `json:"head_sha"`
	Validators []ValidatorRun `json:"validators"`
	// Fix is the verified receipt of the fresh implementer the round's
	// findings were handed to; once set, the next step opens the next round.
	Fix string `json:"fix,omitempty"`
	// Routes is the tier each agent the round handed out ran at, one record
	// per role, in the order the round handed them out (spc-2609251028149555,
	// AC 10): the validators, and the fresh implementer the round's findings
	// went to. Empty for a round handed out with no routing read.
	Routes []Round `json:"routes,omitempty"`
	// Comparisons is how each reviewer role's reviewers compared, one per
	// role, written as the last of the role's returns is recorded; empty for
	// a round opened with no review set (reviewers.go).
	Comparisons []Comparison `json:"comparisons,omitempty"`
	// Judge is the round's judge (judge.go): set once the round, its every
	// validator returned, finds a reviewer role disagreeing on a run whose
	// judge is active; nil on every other round.
	Judge *RoundJudge `json:"judge,omitempty"`
}

ValidationRound is one round of the validate stage: the validators it hands the lane's head to, one at a time, and the fresh implementer it hands their findings to when one of them did not pass.

type ValidatorRun added in v0.12.0

type ValidatorRun struct {
	Role   string `json:"role"`
	Brief  string `json:"brief"`
	Return string `json:"return"`
	// Verdict is the verdict the loop parsed from the return; empty until the
	// return is handed back. Pass is whether it lets the lane advance.
	Verdict string `json:"verdict,omitempty"`
	Pass    bool   `json:"pass"`
	// Audit is the fidelity audit's request and reading, on the
	// intent-auditor's run.
	Audit *AuditRun `json:"audit,omitempty"`
	// Route is the route that ran the validator when a runner ran it; absent
	// when the host ran it. It is the one field a runner-run review's record
	// differs in from a host-run one's (itd-2609201916056194 criterion 7).
	Route *runner.RouteRecord `json:"route,omitempty"`
	// Reviewer is the validator's index among its role's reviewers in the
	// round, from 0 (reviewers.go): absent reads as 0, the role's first or
	// only reviewer, which is how a round written before version 20 reads.
	Reviewer int `json:"reviewer,omitempty"`
	// Class is the model class the run's review set asked the reviewer for,
	// and Model the <provider>/<model> route the class map resolved it to;
	// both empty for a round opened with no review set and for the
	// intent-auditor, which keeps its single run.
	Class string `json:"class,omitempty"`
	Model string `json:"model,omitempty"`
	// Effort is the class's effort the reviewer was asked to run at
	// (itd-2611101419006280): handed to a runner that can pass it, asked of
	// the host, and never confirmed. Empty wherever Class is, and for a run
	// started before efforts.
	Effort string `json:"effort,omitempty"`
	// ModelStatus says how far Model is known to be the model that ran, once
	// the verdict is recorded: ModelReported when the runner that ran the
	// reviewer reported a model (Route.Model, beside it), ModelAsked when
	// only the asking is known, as for every host-run reviewer, whose model
	// is asked for and never confirmed, and ModelUnsent when the reviewer
	// route answered (Route.Ran is oracle.ReviewRP): that route is sent no
	// model, so Model was never asked of what ran. Empty while the reviewer
	// is out and wherever Model is.
	ModelStatus string `json:"model_status,omitempty"`
	// Located is how many located findings (findings.go) the loop read from a
	// reviewer's return when it recorded the verdict, 0 included, and
	// Findings the first maxLocatedFindings of them, kept on the lane's
	// latest round only and dropped from it too when the state would outgrow
	// its read (stateData); both absent on the intent-auditor, while the
	// reviewer is out, and on a verdict recorded before version 24.
	Located  *int      `json:"located,omitempty"`
	Findings []Finding `json:"findings,omitempty"`
	// WriterModels are every model that wrote into the lane up to the round
	// the reviewer judges, in the order they wrote (laneWriters): for each
	// implementer's receipt, the model its runner reported and the one the
	// receipt named, where each is known. ReviewerModel is the model the
	// reviewer was asked for, its class's or the class the loop took instead
	// when that class held a writer's model (reviewers.go), and once it
	// returned the model its runner reported, where one did; for a reviewer no
	// class was asked of, the model its runner reported, else the one its
	// return named. ReviewerNamed is the model its return named, kept only
	// where that is not the same model as ReviewerModel. All three are written
	// on the code-review roles alone. ModelsUnrecorded marks a reviewer an
	// earlier version had handed out before any of them were recorded: it is
	// set only as such a file is read, and keeps none of them.
	WriterModels     []string `json:"writer_models,omitempty"`
	ReviewerModel    string   `json:"reviewer_model,omitempty"`
	ReviewerNamed    string   `json:"reviewer_named,omitempty"`
	ModelsUnrecorded bool     `json:"models_unrecorded,omitempty"`
	// ReturnSHA256 is the SHA-256 of the return, in hex, as the loop read it
	// when it recorded the verdict: every later read of the return the
	// landing makes is held to it (recordedReturn). Absent while the
	// validator is out, and on a verdict recorded before version 31.
	ReturnSHA256 string `json:"return_sha256,omitempty"`
}

ValidatorRun is one validator of a round: the fresh agent handed the lane, its brief, the return it writes, and the verdict the loop parsed from that return.

type Verifier

type Verifier func(c Context, lane *Lane, receipt string) error

Verifier checks the receipt an agent stage waited on. An error refuses the receipt and the lane stays where it was.

type Waiting added in v0.13.0

type Waiting struct {
	Lane  string    `json:"lane"`
	Role  string    `json:"role"`
	Since time.Time `json:"since"`
}

Waiting is one piece of work the ceiling held back.

type WallEnded added in v0.17.0

type WallEnded struct{ Ended string }

WallEnded is a BeforeStage's error when a wait inside the check ended the run for a reason of its own, which the run ends on: a stop, a kill, or a limit it could not outwait.

func (*WallEnded) Error added in v0.17.0

func (e *WallEnded) Error() string

type WidenResult added in v0.16.1

type WidenResult struct {
	RunID     string   `json:"run_id"`
	Lane      string   `json:"lane"`
	Record    string   `json:"record"`
	Added     []string `json:"added"`
	Footprint []string `json:"footprint"`
	Note      string   `json:"note"`
}

WidenResult is a widening's outcome: the run and lane, the paths newly held (none when the reservation already covered every one), the footprint the reservation holds after, and the run record's line.

func Widen added in v0.16.1

func Widen(repoRoot, runID, laneID string, paths []string, o Options) (WidenResult, error)

Widen widens the reservation of run runID, for its current lane laneID, to cover paths before the lane's implementer edits them: a host session's step, since the loop widens the hold to what the lane's branch changes itself once the receipt is handed back (widenLaneChanges). A path the reservation already covers adds nothing, and when it covers every one nothing is pushed. A run that holds no reservation (no origin) has nothing to widen and says so. Refused for a person (exit 2): a lane that is not the run's current one or not at an editing stage; a path no reservation may carry; a reservation the view does not show this copy holding. Contention (exit 3): another copy's live hold on one of the paths, with nothing pushed and a run record line saying the widening backed off; or a locked run state. A lane's own abcd may run it, so the save is the reservation's alone (mutateReservation, iss-2611020719494343).

Jump to

Keyboard shortcuts

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