Engine: run findings ledger, findings gate, loop continuation, larger memory, loop lint, retry partial work, resume_session

- 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>
This commit is contained in:
2026-12-03 14:22:28 +00:00
parent c4de1de27b
commit 34b8b94223
39 changed files with 2314 additions and 132 deletions
+15 -1
View File
@@ -59,6 +59,7 @@ type options struct {
transcripts bool
step int
version, expected, limit, retryVisit int
extraVisits int
timeout, waitTimeout time.Duration
stageModels stageModelFlags
}
@@ -187,6 +188,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
f.StringVar(&o.retryMode, "mode", "resume", "Retry mode: resume failed stage or restart from entry")
f.StringVar(&o.retryStage, "stage", "", "Retry this recorded stage (required when it was visited more than once)")
f.IntVar(&o.retryVisit, "visit", 0, "1-based occurrence of --stage in the recorded execution")
f.IntVar(&o.extraVisits, "extra-visits", 0, "Grant 1-5 extra visits and continue an exhausted loop; with --stage, only that stage gets them")
f.IntVar(&o.version, "version", 0, "Explicit published version of the same pipeline (default: source version)")
f.StringVar(&o.retryInputFile, "input-file", "", "JSON object merged into the selected stage input; '-' reads stdin")
f.StringVar(&o.notifyMode, "notify", "auto", "Notifications for this retry: auto, on, or off")
@@ -1036,7 +1038,19 @@ func (a App) Run(ctx context.Context, args []string) error {
if o.retryVisit < 0 {
return fmt.Errorf("--visit must be positive")
}
r, err := call(protocol.Message{Type: typeName, RunID: id, RequestKey: key, RetryMode: o.retryMode, RetryStage: o.retryStage, RetryVisit: o.retryVisit, RetryVersion: o.version, RetryInput: retryInput, NotifyMode: o.notifyMode})
message := protocol.Message{Type: typeName, RunID: id, RequestKey: key, RetryMode: o.retryMode, RetryStage: o.retryStage, RetryVisit: o.retryVisit, RetryVersion: o.version, RetryInput: retryInput, NotifyMode: o.notifyMode}
if o.extraVisits != 0 {
if o.extraVisits < 1 || o.extraVisits > 5 {
return fmt.Errorf("--extra-visits must be from 1 to 5")
}
if o.retryVisit > 0 {
return fmt.Errorf("--visit cannot be combined with --extra-visits; --stage names the stage that gets the extra visits")
}
// With --extra-visits, --stage names the stage granted the
// visits; the resume point is the exhausted loop itself.
message.RetryExtraVisits, message.RetryExtraStage, message.RetryStage = o.extraVisits, o.retryStage, ""
}
r, err := call(message)
if err != nil {
return err
}