Skip to main content

classify_exit_line

Function classify_exit_line 

Source
fn classify_exit_line(
    exit_code: Option<i32>,
    line: &str,
) -> Option<AgentFailure>
Expand description

Classify a flushed error line, if it’s confident enough to surface to the pane’s failure-recovery UI. line is usually the same result-frame JSON the mid-stream error-result path handles, but persistent_resume::ResumeEffect::FlushErrorLine can also carry an earlier held-back turn’s line — falls back to raw-text keyword matching (the same classify() uses for a stderr tail) if it doesn’t parse as JSON. exit_code is Some at the process-exit arm and None at the mid-generation flush sites (a superseded spawn generation, or a SessionCaptured resolution), where no fresh exit code exists for the line being flushed. Returns None for an unrecognized, non-retryable FailureClass::UnknownNonZero to avoid a low-confidence banner from noisy flushed text — every other recognized class is surfaced, not just the retryable ones, since the recovery banner has value for e.g. Auth too (see SPEC_AGENT_FAILURE_RECOVERY_UI_2026_06_16.md’s per-class action matrix), just without auto-retry. See SPEC_PERSISTENT_CONTROLLER_FAILURE_CLASSIFICATION_2026_08_04.md.