Expand description
Failure classification heuristics (RFC-029 §3.3).
The strategy, in priority order:
- Downcast fast-path — attempt to downcast to oxi-sdk structured
error types. Today the typed
ProviderErroris stringified at the oxi-agent boundary, so this rarely succeeds. Kept for forward compatibility if upstream preserves the type in a future release. - Cause-chain Display walk — collect every cause’s Display
string, then pattern-match. The chain matters because the
outermost
anyhow::Erroris often a wrapper like “Agent run failed” and the actualProviderErrorDisplay is buried one or two levels deep (e.g.AgentError::RetriesExhausted { last_error }→last_error: String). - Default —
FailureClass::Unknown. Conservative: the coordinator will attempt one same-model retry, then escalate.
Patterns are matched case-insensitively against the lowercased
concatenated cause chain. Keep them under test (this file’s
#[cfg(test)] block) and review on oxi-ai upgrades — a provider
changing its error wording degrades classification to Unknown, which
is the safe fallback.
Functions§
- classify
- Classify an
anyhow::Errorinto aFailureClass.