Merge main (findings ledger, loop continuation) into usage-limit branch
Keeps the findings ledger, extra visits and on_exhausted=decide alongside the run budget, failure classes, quota parking and error-loop backoff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -59,6 +59,7 @@ type options struct {
|
||||
transcripts bool
|
||||
step int
|
||||
version, expected, limit, retryVisit int
|
||||
extraVisits int
|
||||
timeout, waitTimeout time.Duration
|
||||
stageModels stageModelFlags
|
||||
// quotaNow / quotaDefer choose what run and retry do about a known usage
|
||||
@@ -225,6 +226,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")
|
||||
@@ -1092,7 +1094,19 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
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, QuotaPolicy: policy, BudgetUSD: o.budgetUSD})
|
||||
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, QuotaPolicy: policy, BudgetUSD: o.budgetUSD}
|
||||
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 quotaHint(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user