Documentation
¶
Overview ¶
orphan: agent self-debugging (master plan §5.7); to be invoked from error-recovery flow once a result-channel is plumbed
Package diagnostic — 10-tier feedback loop ladder (master plan §4.13).
When a fix attempt fails, escalate the verification depth one tier at a time. Each tier is more expensive than the last; we only climb when the previous tier passed but the bug recurred (a stronger signal that the last tier didn't actually exercise the broken behavior).
The ladder is deliberately ordered cheapest → most expensive:
- compile — does it build?
- unit-test — does the failing test now pass?
- broader-test — do the surrounding tests pass?
- lint — does static analysis flag anything?
- cli — does invoking via CLI reproduce the symptom?
- curl — does an end-to-end network probe pass?
- headless-browser — does headless browser smoke pass?
- property — does property-based / fuzz testing find a counterexample?
- bisect — git bisect against prior known-good?
- hitl-bash — surface to the human; ask them to run a bash check.
The ladder is data — callers (tools, slash command, the agent itself) pick a starting tier and climb. We don't execute the commands here; callers map a Tier to the right tool/CLI invocation for their context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLadderExhausted = errors.New("diagnostic: ladder exhausted (escalate to human)")
ErrLadderExhausted indicates Climb was called past the top tier.
Functions ¶
func FormatApproach ¶
func FormatReport ¶
func FormatReport(report *DiagnosticReport) string
Types ¶
type AnalyzeRequest ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func (*Analyzer) Analyze ¶
func (a *Analyzer) Analyze(ctx context.Context, req AnalyzeRequest) (*DiagnosticReport, error)
func (*Analyzer) ClassifyError ¶
type DiagnosticReport ¶
type DiagnosticReport struct {
Error string `json:"error"`
ErrorType string `json:"error_type"`
AffectedFiles []FileInfo `json:"affected_files"`
RootCauses []RootCause `json:"root_causes"`
Approaches []Approach `json:"approaches"`
Confidence float64 `json:"confidence"`
Recommendation string `json:"recommendation"`
Timestamp time.Time `json:"timestamp"`
}
type FileRole ¶
type FileRole struct {
Path string `json:"path"`
Role string `json:"role"`
Package string `json:"package"`
Type string `json:"type"`
Exports []string `json:"exports"`
}
func AnalyzeFile ¶
type Ladder ¶
type Ladder struct {
// contains filtered or unexported fields
}
Ladder tracks progress up the tiers. Climb() returns the next tier to try, or io.EOF-style sentinel when exhausted.
func (*Ladder) Climb ¶
Climb advances to the next tier. Returns ErrLadderExhausted when there are no more rungs.
type Tier ¶
type Tier int
Tier is one step on the verification ladder.
func (Tier) Description ¶
Description explains what the tier verifies.
func (Tier) SuggestedCommand ¶
SuggestedCommand returns a starter shell command for the tier given a language ecosystem. Empty when no obvious default applies.