Expand description
Per-provider stderr classification into throttle / flake / unknown.
Complements crate::agent_run_record::ExitClassifier: the classifier
here consumes configurable per-provider regex lists so operators can
tune detection per CLI (claude-code, opencode-go, kimi-for-coding,
…) without code changes. Matches feed the existing
terraphim_spawner::health::CircuitBreaker (via
crate::provider_probe::ProviderHealthMap) and the
crate::provider_budget::ProviderBudgetTracker – nothing new is
invented here.
Classification outcomes:
- Throttle – provider quota / rate-limit hit. Trip the breaker and force the hour+day budget windows past their caps so the routing filter drops the provider until the next window rolls.
- Flake – transient failure (timeout, EOF, connection reset). Do NOT trip the breaker; the dispatch layer retries with the next entry in the pool.
- Unknown – neither list matched. Escalate (fleet-meta issue) so a human can classify the pattern. Unknown is also counted as a soft failure so a pathological provider that repeatedly emits unclassified errors still eventually opens the breaker.
Structs§
- Compile
Error - Compile error building per-provider regex patterns.
- Compiled
Signatures - Runtime-compiled signatures for a single provider.
- Provider
Error Signatures - Serialised form of per-provider error signatures (matches the TOML
layout under
[[providers]].error_signatures).
Enums§
Functions§
- build_
signature_ map - Build a signature map from the raw config list. Invalid regexes surface
as
CompileErrorso misconfiguration fails loud at startup rather than silently disabling classification at runtime. - classify
- Classify a stderr snippet against the provider’s compiled signatures.
- classify_
lines - Classify a list of stderr lines by joining them (newline-separated)
and running
classify. Convenience wrapper for the spawn-exit path where stderr is captured line-by-line. - unknown_
dedupe_ key - Build a stable dedupe key for an unknown-error escalation: provider plus the leading 20 chars of the stderr (both-ends trimmed + lowercased). The short prefix + lowercase normalisation means minor suffix variance (trailing newlines, mixed case, extra detail) dedupes to one key so we don’t spam fleet-meta with duplicate issues for the same stderr shape.
Type Aliases§
- Provider
Signature Map - Map of compiled signatures keyed by provider id.