How AI's Actually Work — HAAW

Failure, Recovery and Retry

What Happens When an AI System Does Not Get the Result It Expected?

The Happy Path Is Only One Path

Our earlier agent loops often looked clean:

GOAL → INFERENCE → TOOL → RESULT → UPDATE STATE → NEXT STEP

Real systems are messier. A tool may time out. Permission may be denied. A file may have changed. A database may reject a query. A model may choose the wrong tool. A service may return malformed data. An operation may succeed while its response is lost.

Failure is not one event. It is a class of outcomes occurring at different layers of the system.

First Question: What Failed?

MODEL

Decision Failure

The model chooses an inappropriate action, arguments or interpretation.

CONTROL

Authorization Failure

The requested operation is denied by policy, credentials or human approval.

TOOL

Invocation Failure

The tool cannot start, rejects arguments or reports an internal error.

TRANSPORT

Communication Failure

A request or response is delayed, lost, interrupted or malformed.

WORLD

External-System Failure

The database, service, host, sensor or other target does not behave as expected.

VERIFY

Outcome Failure

The operation completed, but verification shows the intended result did not occur.

Expected Result Versus Observed Result

An agentic system often operates with an implicit or explicit expectation.

ACTION → EXPECTED STATE ↔ OBSERVED STATE

If they differ, the system has learned something important. But it should not immediately conclude why.

Requested: restart httpd
Tool result: command returned success
Expected: service running
Observed: service still failed
Conclusion: intended outcome not achieved; cause requires further evidence.
Successful execution is not the same thing as successful outcome.

The R/W/X → ΔState Chain

Our permissions work gives us a useful failure-analysis chain:

REQUEST → AUTHORIZATION → EXECUTION → Δ STATE? → VERIFICATION

A failure can occur at every arrow.

StageQuestionExample
RequestWas the intended action represented correctly?Wrong hostname supplied.
AuthorizationWas the action permitted?Permission denied.
ExecutionDid the operation actually run?Tool process crashed.
State ChangeWhat changed?File written, service unchanged.
VerificationDid the desired outcome occur?HTTP still unavailable.

Retry Is Not “Try Again Until It Works”

A retry is another attempt at an operation after a previous attempt did not produce a usable confirmed result.

ATTEMPT 1 ✗ → CLASSIFY FAILURE → IS RETRY SAFE / USEFUL? → ATTEMPT 2

The middle question is critical.

Blind retry can turn a temporary failure into duplicate or destructive work.

Safe Retry: The Easy Case

Suppose a read-only status request times out before returning data. Repeating it may be reasonable because the operation is observational and inexpensive.

Attempt 1: service_status(web01) → timeout
Attempt 2: service_status(web01) → httpd failed

The retry produced a usable observation.

Ambiguous Failure: The Dangerous Case

Now suppose an agent requests creation of a ticket:

CREATE TICKET → SERVER PROCESSES REQUEST → RESPONSE LOST

The agent sees a timeout. Did creation fail—or did creation succeed and only the reply fail?

Blindly retrying might create a second ticket.

“I did not receive confirmation” does not mean “the operation did not happen.”

Idempotency

An operation is idempotent when repeating the same intended operation does not create additional unintended effects.

A system can use an operation identifier:

operation_id: ticket-create-4817
Attempt 1: response lost
Attempt 2: same operation_id
Server: recognizes operation already completed; returns original result instead of creating another ticket.

Idempotency makes retries much safer, especially across unreliable networks.

Retry Identity and Lineage

WITNESS should not record three attempts as three unrelated actions.

TASK T17
├── ATTEMPT A1 — timeout
├── ATTEMPT A2 — timeout
└── ATTEMPT A3 — success

The attempts share one task identity while retaining separate timestamps, inputs, outputs and errors.

When Not to Retry

Permission Denied

Repeating the same unauthorized action usually changes nothing.

Bad Arguments

Retrying malformed input without correcting it repeats the same defect.

Permanent Failure

A nonexistent resource may require a different plan, not more attempts.

Unsafe Ambiguity

If an earlier state-changing operation may already have succeeded, verify before repeating.

Retry With Change

Sometimes the next attempt should deliberately differ from the first.

FAILURE → NEW EVIDENCE → REVISED ACTION → NEW ATTEMPT

That is not merely retry—it is recovery reasoning.

Attempt 1: read primary source → unavailable
Observation: service outage
Recovery: use approved secondary source
Attempt 2: retrieve secondary source → success
Report: note fallback provenance.

Backoff — Do Not Hammer a Failing System

If a service is temporarily overloaded, retrying immediately and repeatedly can make the problem worse.

FAIL → WAIT 1s → FAIL → WAIT 2s → FAIL → WAIT 4s …

This simplified pattern is called exponential backoff. Real systems may add limits and randomized delay so many clients do not retry in lockstep.

Timeouts Are Decisions

A timeout does not prove that the remote operation failed. It says the waiting component stopped waiting after its configured interval.

Timeout is an observation about waiting—not necessarily an observation about remote execution.

This distinction is extremely important for forensic reconstruction.

Recovery Can Mean Rollback

Suppose a multi-step operation changes several resources and fails halfway through.

STEP A ✓ → STEP B ✓ → STEP C ✗

Possible responses include:

Continue

If remaining work can safely proceed another way.

Retry C

If the failed step is safely retryable.

Rollback

Attempt to restore earlier state.

Stop and Escalate

Preserve evidence and request human intervention.

Rollback itself is another state-changing operation and can fail. “Undo” is not magic.

Partial Success

Many real outcomes are neither success nor failure.

Requested: inspect 100 files
Read successfully: 94
Permission denied: 4
Missing: 2

A truthful system should preserve the partial result rather than compressing it to either “worked” or “failed.”

Recovery in a Multi-Agent System

Suppose Agents A, B and C are investigating in parallel and C fails.

A ✓    B ✓    C ✗ → ORCHESTRATOR DECISION

The orchestrator might retry C, assign the task to another agent, use A/B if sufficient, change tools, wait for recovery, or escalate to a human.

Failure therefore changes the dependency graph.

Reassignment Is Not Independent Evidence

If C fails and the same task is handed to C2 using the same model, same source and same assumptions, the second result may improve availability—but it is not automatically independent verification.

Recovery and verification are different goals.

Checkpointing Long Jobs

A long-running agentic mission may preserve progress so a failure does not require starting from zero.

MISSION START → WORK → CHECKPOINT → WORK → FAILURE

RECOVERY → LOAD CHECKPOINT → RESUME

This checkpoint is task/system state—not necessarily a model-training checkpoint. Same word, different layer.

Failure Can Corrupt Context

Imagine a tool returns malformed or misleading data and the agent accepts it as valid. That result can enter context and influence later reasoning.

BAD RESULT → CONTEXT → NEXT INFERENCE → BAD DECISION → FURTHER CONSEQUENCES

Therefore validation should happen as close as practical to the boundary where data enters the system.

The Model Can Be Wrong About Failure

A model may interpret an unfamiliar tool response incorrectly, assume a timeout means failure, or confidently propose a recovery that is inappropriate.

Recovery policy should not depend solely on fluent model interpretation when machine-readable status, explicit error codes, transactions or external verification are available.

Stop Conditions Matter

Without limits, an agent can enter an expensive or useless loop.

TRY → FAIL → RETRY → FAIL → RETRY → …

Useful controls include maximum attempts, maximum elapsed time, cost/token limits, repeated-error detection, escalation rules and human approval.

Knowing when to stop is part of recovery design.

WITNESS: Failure Is Evidence

A failed attempt should not disappear merely because a later retry succeeded.

Original request · task ID · attempt ID · parent event · model/tool identity · arguments · authorization result · start/end time · returned status · raw error · timeout boundary · known/unknown state change · retry decision · recovery action · final verification.

The failure may explain later behavior. Removing it from the record destroys causal history.

Known Unknown: Did State Change?

One of the most important forensic outcomes may be:

STATE CHANGE UNKNOWN.

If a state-changing request was sent and the connection died before confirmation, WITNESS should preserve that uncertainty until independent evidence resolves it.

Do not silently turn an unknown into either success or failure.

A Recovery Decision Tree

UNEXPECTED RESULT
↓
WHAT FAILED?
↓
WAS EXTERNAL STATE POSSIBLY CHANGED?
↓
VERIFY IF NEEDED
↓
IS RETRY SAFE AND USEFUL?
↓
RETRY / REVISE / FALL BACK / ROLLBACK / ESCALATE / STOP
↓
VERIFY FINAL STATE

The Boundary

A failure may occur in the model decision, authorization, tool, transport, external system or outcome.

A timeout does not prove the remote operation failed.

A successful command does not prove the intended outcome occurred.

Retry is an engineering decision, not a reflex.

State-changing operations require special care when previous success is uncertain.

Recovery can include retry, revised action, fallback, rollback, reassignment, escalation or stopping.

Failures and retries belong in the evidence record.

When the result is unexpected, first determine what is known before deciding what to do again.

HAAW Checkpoint

Failure: An operation or system outcome that does not provide the required usable result.

Retry: Another attempt at an operation after an earlier attempt did not yield a usable confirmed result.

Recovery: The broader process of responding to failure and restoring progress or a safe known state.

Timeout: A local decision to stop waiting after a configured interval; not proof of remote failure.

Idempotency: A property allowing an intended operation to be repeated without duplicating its effect.

Backoff: Deliberately increasing delay between retries to reduce load and allow recovery.

Rollback: An attempt to reverse earlier state changes after partial failure.

Partial Success: An outcome in which some requested work succeeded and some did not.

Checkpoint: Preserved task/system progress from which work can potentially resume.

Attempt ID: Identity distinguishing individual attempts while linking them to the same task.

Unknown State: A condition where available evidence cannot yet establish whether an external change occurred.

Central lesson: Retry only after asking what failed, what may already have changed, and whether repeating the operation is safe.