34b8b94223
- Runner-owned findings ledger per run: stages report a # findings section (new items and F<n> status changes); stable IDs, persisted (run_loop_state), in RunDetail.findings, findings.md, memory.md, inspect. - type=findings gate stage routes open/clear on the ledger mechanically. - retry --extra-visits N [--stage KEY] continues an exhausted loop; limits on_exhausted=decide parks the run on accept/continue/abort. - Essential memory cap 20 KB, task never truncated, handoff and open findings ahead of the outcome ledger. - Lint rejects limits.on outcomes on forward edges; warns on ineffective limits and resume_session. - A resumed retry carries the failed visit's output.md and private/ under previous-attempt/. - resume_session=true resumes a Claude stage's previous session on loop visits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.2 KiB
Go
65 lines
2.2 KiB
Go
package protocol
|
|
|
|
// Finding is one item of a run's findings ledger. The runner owns the ledger:
|
|
// stages report new findings and status changes in an output.md "# findings"
|
|
// section, and the runner assigns the stable ID (F1, F2, ...), keeps the latest
|
|
// status and records every change as an event.
|
|
type Finding struct {
|
|
ID string `json:"id"`
|
|
Severity string `json:"severity"`
|
|
Origin string `json:"origin"`
|
|
Location string `json:"location,omitempty"`
|
|
Summary string `json:"summary"`
|
|
Status string `json:"status"`
|
|
// Reason is the latest status change's reason.
|
|
Reason string `json:"reason,omitempty"`
|
|
RaisedBy string `json:"raised_by"`
|
|
RaisedSequence int `json:"raised_sequence"`
|
|
UpdatedBy string `json:"updated_by,omitempty"`
|
|
UpdatedSequence int `json:"updated_sequence,omitempty"`
|
|
Events []FindingEvent `json:"events,omitempty"`
|
|
}
|
|
|
|
// FindingEvent is one status change of a finding, in the visit that made it.
|
|
type FindingEvent struct {
|
|
Sequence int `json:"sequence"`
|
|
Stage string `json:"stage"`
|
|
Status string `json:"status"`
|
|
Reason string `json:"reason,omitempty"`
|
|
}
|
|
|
|
// Finding severities (most severe first), statuses and origins.
|
|
const (
|
|
SeverityCritical = "critical"
|
|
SeverityImportant = "important"
|
|
SeverityMinor = "minor"
|
|
SeverityNit = "nit"
|
|
|
|
FindingOpen = "open"
|
|
FindingFixed = "fixed"
|
|
FindingDismissed = "dismissed"
|
|
FindingSettled = "settled"
|
|
|
|
OriginIntroduced = "introduced"
|
|
OriginPreExisting = "pre-existing"
|
|
)
|
|
|
|
// ExhaustedKey marks a waiting (then decided) step the runner created when a
|
|
// loop exhausted its visits on a stage with on_exhausted=decide. The value is a
|
|
// map with stage, visit, max_visits and targets (option -> target). Such a step
|
|
// is a decision, never a stage visit.
|
|
const ExhaustedKey = "exhausted"
|
|
|
|
// Exhaustion decision options.
|
|
const (
|
|
ExhaustedAccept = "accept"
|
|
ExhaustedContinue = "continue"
|
|
ExhaustedAbort = "abort"
|
|
)
|
|
|
|
// ExhaustedInfo reads the exhaustion marker from a step output, or nil.
|
|
func ExhaustedInfo(output map[string]any) map[string]any {
|
|
info, _ := output[ExhaustedKey].(map[string]any)
|
|
return info
|
|
}
|