Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Failure windows and recovery invariants

Actual response loss/process exit,red-green acceptance repair and cross-ledger incident review.

Learning objectives: Reproduce unknown results,locate receipt/idempotency boundaries and write negative checks explaining recovery/effects.

Content checked: 2026-10-11 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Design · Explain the trade-offs. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Failure windows and recovery invariants
Recovery correctness is determined by the business facts before and after the failure. The test must cut off the window between "submission, receipt, and status advancement" to prove that replay will not break idempotency, permissions, and budget constraints.

How does the mechanism work?

Step-by-step explanation
  1. What is the difference between repeat requests and repeat effects?

    Recovery often relies on resending requests, so distinguish network attempts from actual business effects.

  2. Why is fixed model response still valuable for testing?

    Fault-injection experiments require repeatable control of variables, so explain the value and limits of test doubles.

  3. Does stopping at unknown when it cannot be verified count as a test failure?

    When the expected receipt is missing, specify exactly what the test requires.

Design · Explain the trade-offs

Explain design trade-offs · Failure windows and recovery invariants

Objectives of this level: Execute another window,present incident and cross-service limits.

Visual guide · Commit can precede knowledge

Commit can precede knowledge

The local fault commits one merchant application before losing its response. A missing caller receipt does not establish zero effects. Select the figure to open it at full size.

Five-minute incident review

Use fault 75, wrong acceptance 1, one merchant effect, original-key recovery/correct acceptance 0 to explain trigger→unknown→diagnosis→repair→rerun. Your repair concerns assumptions/checkers; the project already reconciles. Show your binding-negative code as coding evidence.

Derive injection from invariants

For before commit, commit before response, response before checkpoint and completed replay, give location, knowledge, authoritative fact, recovery and acceptance. Execute another window with commands, exits, both ledgers; mark unexecuted items as plans. Cancel, revocation, expiry, policy changes and takeover are not one timeout switch.

Cross-service limits

Keep identity/key, reconcile authority, then update local state. General found=false may not exclude a later commit; lookup consistency, timeout windows and replay contracts matter. Atomic local effect/receipt and task uniqueness are not universal payment/email exactly-once. Without guarantees, pause, bound retries or reconcile manually and record unmet deadlines.

More services need new contracts

Inventory/refunds add commits. Compensation needs approval, key and receipt, not erased history. Queues/outboxes can redeliver; receivers still deduplicate/reconcile. AWS guidance supports the proposal; no real queue/distributed compensation was tested. Submit added-window evidence, your check diff, manual conditions and limits.

An executable additional window

Save after_response_probe.py and run python3 after_response_probe.py with fresh after-response-work. Existing prepared creates/approves a proposal but does not commit it. --fault after_send exits 75 after the actual merchant response and before local receipt checkpointing. Observed before: executing/null/merchant 1; after: completed/original receipt/merchant 1. Do not copy outcome_unknown from the other window into this one. Recovery is supplied behavior; add or repair your own check and explain the saved red/green evidence.

import json
from pathlib import Path
from drills import prepared
from harness import client,merchant_process,wait_for_lease,worker
from store import Store
w=Path('after-response-work');w.mkdir(exist_ok=True)
with merchant_process(w) as service:
 s=Store(w/'agent.sqlite');prepared(s,service.url,'after-response')
 crash=worker(w,service.url,'execute','--task-id','after-response','--fault','after_send','--lease-seconds','.3',expected=75)
 before=s.inspect('after-response')
 n=sum(x['task_id']=='after-response' for x in client(service.url,'admin-token').request('GET','/v1/audit')['returns'])
 assert before['status']=='executing' and before['receipt'] is None and n==1
 wait_for_lease(s,'after-response')
 resumed=worker(w,service.url,'execute','--task-id','after-response')
 after=s.inspect('after-response')
 an=sum(x['task_id']=='after-response' for x in client(service.url,'admin-token').request('GET','/v1/audit')['returns'])
 assert after['status']=='completed' and after['receipt'] and n==an==1
 result={'window':'response_received_before_local_receipt_checkpoint','crash':crash,'resume':resumed,
         'before_status':before['status'],'before_receipt':before['receipt'],'merchant_before':n,
         'after_status':after['status'],'merchant_after':an,'receipt':after['receipt']}
 (w/'result.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,sort_keys=True));s.close()

code example

Evidence and interview explanation

Execute another window,present incident and cross-service limits.

Use the inputs,code,exits and ledgers above;submit your own diff,not copied green logs,and name unverified capabilities.

Acceptance task for this level

Execute another window,present incident and cross-service limits.

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

New key after found=false?

Further explanations and practice

When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.

All linked explanations and exercises (1 )

Sources and verification scope

The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.