fatal

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package fatal detects non-retryable harness failures (billing exhaustion, invalid credentials, disabled accounts, codex model/auth mismatches).

It is a 1:1 port of swe_af/execution/fatal_error.py. When the underlying API returns a fatal error, retrying is pointless and wastes time, so FatalHarnessError is a distinct error type that short-circuits every retry layer. CheckFatalHarnessError inspects a *appx.HarnessResult and returns a FatalHarnessError immediately on match, so the real error message surfaces instead of a misleading generic one.

Ref: https://github.com/Agent-Field/SWE-AF/issues/49

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFatalHarnessError

func CheckFatalHarnessError(result *appx.HarnessResult) error

CheckFatalHarnessError inspects a harness result and returns a *FatalHarnessError if it indicates a non-retryable API failure, or nil otherwise.

It should be called immediately after the harness returns, before any Result.Parsed == nil check, so the real error message surfaces instead of a misleading generic one. It reads Result.IsError and Result.ErrorMessage (the Go equivalents of the Python HarnessResult's is_error / error_message).

func IsFatalError

func IsFatalError(errorMessage string) bool

IsFatalError reports whether errorMessage matches a known fatal API error pattern. An empty string is never fatal (mirrors the Python guard).

Types

type FatalHarnessError

type FatalHarnessError struct {
	OriginalMessage string
}

FatalHarnessError is returned when the harness encounters a non-retryable API error. It is designed to propagate through all retry layers (schema retries, SDK execution retries, pipeline retries) without being swallowed by generic error handling that would otherwise silently retry.

It mirrors the Python FatalHarnessError(RuntimeError): Error() reproduces the exact "Fatal API error (non-retryable): <message>" text, and OriginalMessage carries the untouched underlying message (Python's .original_message).

func (*FatalHarnessError) Error

func (e *FatalHarnessError) Error() string

Error returns the wrapped message, byte-identical to the Python exception's str() form.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL