Skip to content

@usine/core/attempt/failure

The agent ran and failed the work itself. Never auto-retried, since the same agent would fail the same way; the operator decides what changes first.

  • Schema.Class

new AgentFailure(…args): AgentFailure

Parameter Type
…args [props: object, options?: MakeOptions]

AgentFailure

readonly message: string


The parent tried to spawn more child sessions than the Attempt allows. Never auto-retried, since the same parent would exhaust the same budget again.

  • Schema.Class

new ChildSessionBudgetFailure(…args): ChildSessionBudgetFailure

Parameter Type
…args [props: object, options?: MakeOptions]

ChildSessionBudgetFailure

readonly attemptedChildren: number & Brand<"ChildSessionCount">

readonly maxChildren: number & Brand<"ChildSessionBudget">


A programmer defect captured at the durable execution boundary. Retains its cause for diagnosis and requires an operator retry.

  • Schema.Class

new DefectFailure(…args): DefectFailure

Parameter Type
…args [props: object, options?: MakeOptions]

DefectFailure

readonly cause: unknown

readonly message: string


Infrastructure failed around the agent: worker unreachable, checkout failed, parent task lost. The only class the engine retries on its own, capped.

  • Schema.Class

new InfraFailure(…args): InfraFailure

Parameter Type
…args [props: object, options?: MakeOptions]

InfraFailure

readonly cause: unknown

readonly message: string


The runaway guard interrupted an attempt that burned without progress. Never auto-retried (ADR 0013).

  • Schema.Class

new RunawayFailure(…args): RunawayFailure

Parameter Type
…args [props: object, options?: MakeOptions]

RunawayFailure

readonly ceiling: "wall-clock" | "tokens"

AttemptFailure = typeof AttemptFailure.Type


RunawayCeiling = typeof RunawayCeiling.Type

Which per-attempt ceiling the runaway guard tripped.

const AttemptFailure: Schema.Union<readonly [typeof InfraFailure, typeof DefectFailure, typeof AgentFailure, typeof RunawayFailure, typeof ChildSessionBudgetFailure]>


const isAutoRetryableFailure: <I>(input) => input is I & InfraFailure

The class half of the auto-retry law: only infra failures qualify. shouldAutoRetry adds the attempt cap.

Type Parameter
I
Parameter Type
input I

input is I & InfraFailure


const RunawayCeiling: Schema.Literals<readonly ["wall-clock", "tokens"]>

Which per-attempt ceiling the runaway guard tripped.