Documentation
¶
Overview ¶
Package recovery stores retry recipes and recovery state for failed runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllScenarioNames ¶
func AllScenarioNames() []string
Types ¶
type AttemptOptions ¶
type AttemptReport ¶
type AttemptReport struct {
Kind string `json:"kind"`
Recipe Recipe `json:"recipe"`
Entry LedgerEntry `json:"entry"`
Result Result `json:"result"`
Events []Event `json:"events"`
}
type AttemptState ¶
type AttemptState string
const ( StateQueued AttemptState = "queued" StateRunning AttemptState = "running" StateSucceeded AttemptState = "succeeded" StateFailed AttemptState = "failed" StateExhausted AttemptState = "exhausted" )
type CommandResult ¶
type CommandResult struct {
Step Step `json:"step"`
State AttemptState `json:"state"`
Result string `json:"result"`
}
type EscalationPolicy ¶
type EscalationPolicy string
const ( EscalationAlertHuman EscalationPolicy = "alert_human" EscalationLogAndContinue EscalationPolicy = "log_and_continue" EscalationAbort EscalationPolicy = "abort" )
type LedgerEntry ¶
type LedgerEntry struct {
RecipeID string `json:"recipe_id"`
AttemptType string `json:"attempt_type"`
Trigger Scenario `json:"trigger"`
AttemptCount int `json:"attempt_count"`
RetryLimit int `json:"retry_limit"`
AttemptsRemaining int `json:"attempts_remaining"`
State AttemptState `json:"state"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
CommandResults []CommandResult `json:"command_results,omitempty"`
Result *Result `json:"result,omitempty"`
LastFailureSummary string `json:"last_failure_summary,omitempty"`
EscalationReason string `json:"escalation_reason,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
type Recipe ¶
type Recipe struct {
ID string `json:"id"`
Scenario Scenario `json:"scenario"`
Steps []Step `json:"steps"`
MaxAttempts int `json:"max_attempts"`
EscalationPolicy EscalationPolicy `json:"escalation_policy"`
}
type Result ¶
type Result struct {
Kind ResultKind `json:"kind"`
StepsTaken int `json:"steps_taken,omitempty"`
Recovered []Step `json:"recovered,omitempty"`
Remaining []Step `json:"remaining,omitempty"`
Reason string `json:"reason,omitempty"`
}
type ResultKind ¶
type ResultKind string
const ( ResultRecovered ResultKind = "recovered" ResultPartialRecovery ResultKind = "partial_recovery" ResultEscalationRequired ResultKind = "escalation_required" )
type Scenario ¶
type Scenario string
const ( ScenarioTrustPromptUnresolved Scenario = "trust_prompt_unresolved" ScenarioPromptDeliveredToShell Scenario = "prompt_delivered_to_shell" ScenarioStaleBranch Scenario = "stale_branch" ScenarioCompileRedAfterRefactor Scenario = "compile_red_after_refactor" ScenarioMCPHandshakeFailure Scenario = "mcp_handshake_failure" ScenarioPartialPluginStartup Scenario = "partial_plugin_startup" ScenarioProviderFailure Scenario = "provider_failure" )
func AllScenarios ¶
func AllScenarios() []Scenario
func ParseScenario ¶
type StatusReport ¶
type StatusReport struct {
Scenario Scenario `json:"scenario"`
Attempted bool `json:"attempted"`
State AttemptState `json:"state,omitempty"`
AttemptCount int `json:"attempt_count"`
RetryLimit int `json:"retry_limit,omitempty"`
AttemptsRemaining int `json:"attempts_remaining,omitempty"`
EscalationReason string `json:"escalation_reason,omitempty"`
LastFailureSummary string `json:"last_failure_summary,omitempty"`
}
type StepKind ¶
type StepKind string
const ( StepAcceptTrustPrompt StepKind = "accept_trust_prompt" StepRedirectPrompt StepKind = "redirect_prompt_to_agent" StepMergeForward StepKind = "merge_forward_branch" StepCleanBuild StepKind = "clean_build" StepRetryMCPHandshake StepKind = "retry_mcp_handshake" StepRestartPlugin StepKind = "restart_plugin" StepRestartWorker StepKind = "restart_worker" StepEscalateToHuman StepKind = "escalate_to_human" )
type Store ¶
type Store struct {
ConfigHome string
}
func (Store) Attempt ¶
func (s Store) Attempt(scenario Scenario, opts AttemptOptions) (AttemptReport, error)
func (Store) List ¶
func (s Store) List() ([]LedgerEntry, error)
Click to show internal directories.
Click to hide internal directories.