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.
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 ¶
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.