Free learning / 35-minute practice + optional executable lab
Recover an agent action when the receipt is missing
Investigate uncertain actions, then execute a two-database outbox crash: compare duplicate effects, guarded replay and changed requests before handing over recovery.
No account needed. Use your own copy for writing and keep the original as a reference.
Engineering lab library / Run locally
Choose your next agent lab.
Start with the durable workflow reference, then choose the boundary you want to test. Open its walkthrough for setup, commands and expected observations.
Synthetic records. No provider key or model inference. Runs locally with the standard library.
Start here / Python 3.11+ · Standard library
Outbox crash and destination replay
Crash after a destination commit, compare naive and guarded redelivery, and reject a changed payload without closing the original pending work.
Python 3.11+ · Two temporary SQLite databases · Owned child processes · No network
LockedIn Labs · Original FDE training material · Edition 3 · 35-minute core practice + optional 30-minute executable lab
A timeout tells you that the caller did not receive a result in time. In this exercise, you will investigate whether an action happened, decide what can safely be retried and prepare a recovery record the receiving team can use.
The core packet is a tabletop extension to the client-delivery course. The optional two-database lab below executes synthetic local effects only. The existing course starter only reads and drafts; it cannot send or create tickets. This packet imagines a separately authorized future ticket-creation tool. Nothing here activates that capability in LockedIn FDE Training or contacts another system. All events, keys and ticket IDs are synthetic.
The assignment
The proposed tool creates one internal handoff ticket after an authorized operator accepts the exact payload. The agent may propose the action; the receiving service owns authorization and execution. A ticket is an external effect in the hypothetical design, so losing its receipt is different from losing a draft.
Your deliverable is a seven-case recovery table and a one-page operator runbook. Spend five minutes on the contract, twelve on the trace, eight on recovery decisions and ten on a receiving-team teach-back. Use the event trace CSV in a spreadsheet or text editor. No installation, credentials or customer data are needed.
Read the supplied contract
Each logical action has an operation key scoped by the trusted tenant and action type. A caller cannot choose another tenant through the key. In this exercise, accepted payloads have a stable fingerprint; a replay must match the original payload. Changed intent needs a new authorized decision, not a disguised retry.
The hypothetical receiver maintains an operation record that binds the scoped key, accepted payload fingerprint, execution state and result reference. Its receipt replay returns an existing result without repeating the effect. These are supplied fixture assumptions; implementing them in a distributed service requires evidence that the actual receiver and storage provide the promised behavior.
A client deadline does not cancel a dispatched action. The stop control prevents new dispatches; it does not undo completed effects or guarantee cancellation of in-flight work. An unavailable status lookup is not proof of no effect. An ordinary application log is not automatically an authoritative record of the destination's commit.
For A, B, D, E, F and G, the supplied commit events and rejection/replay descriptions are complete for the case. In C, the destination outcome is deliberately unavailable. Do not infer a missing commit from an incomplete observation. Sequence numbers order events within each case, not across cases.
Reconstruct seven cases
Read the CSV first. For each case, write the observed effect count if known, receipt state, whether another execution is permitted and the next responsible role. Keep unknown separate from zero.
| Case | The decision to investigate |
|---|---|
| A | A single dispatch commits and returns its receipt. What should the operator record? |
| B | The receiver commits, the receipt is lost and an identical retry returns a stored receipt. Did the action happen twice? |
| C | The caller times out and the authoritative lookup is unavailable. Can the operator treat this as a failed action and create another? |
| D | A new payload reuses the key of an already committed operation and receives a conflict. Should the client quietly generate another key? |
| E | A caller retries the same business intent under a fresh key after losing the first receipt. What did the key change permit? |
| F | The operator stops new dispatches, but already dispatched work commits afterward. Did the stop control fail its stated contract? |
| G | Two callers submit the same scoped key and payload. One wins an atomic claim; the other waits and receives the stored result. Which evidence prevents two effects in this fixture? |
Use a table with these columns: case; confirmed effects or unknown; receipt evidence; allowed next action; prohibited shortcut; owner; closure evidence. Mark the event that supports every conclusion. A green client screen cannot replace a destination result reference.
Make uncertainty an explicit operator state
For an uncertain action, write interface copy that preserves the operation reference and tells the operator how to reconcile it. Do not display “nothing happened,” automatically retry with a new key or encourage a manual duplicate while the destination result is unknown. Explain what information the receiving operator can safely see and who can inspect the authoritative record.
Decide what the user can continue doing without repeating this action. The course's trusted manual lookup remains available for read-only work; manually creating a replacement ticket is itself a possible duplicate. A recovery path must distinguish those activities.
Separate receipt retrieval from renewed execution. Even a same-key retry is safe only within a demonstrated receiver contract: key scope, payload binding, retention window, concurrent handling and authorization must hold. A header named idempotency-key does not establish those properties by itself.
Repair the right failure
Choose one repair for E and one evidence request for C. Describe the earliest boundary that can prevent another effect and the observation that would show it works. Preserve the original trace instead of replacing a failure with a cleaner demonstration.
For G, challenge the engineer who proposes “check whether the key exists, then insert.” Ask what happens if both callers observe absence before either writes. Identify where a uniqueness constraint, transaction or receiver guarantee would serialize the decision. The fixture reports one atomic claim; it is not a benchmark or proof of a production implementation.
For F, separate stopping new work, reconciling in-flight work and reversing completed work. If a ticket should be corrected, use the destination's authorized correction process with its own evidence. Do not erase an audit event or call a code rollback a reversal of a ticket.
Change one assumption
The receiver retains operation keys for a limited period. Your client reappears after that period with the original key and an uncertain receipt. State which earlier recovery guarantee no longer follows, what destination evidence is needed and who owns the next decision. Do not invent a retention duration or assume the key survives indefinitely.
Then change access: the original operator no longer has permission to create tickets. Explain how the receiver authenticates a receipt lookup and protects the returned reference without granting a new execution. A remembered key is not an authorization credential. A generated plan cannot restore revoked access.
Optional extension: when a remembered key expires
Spend another twenty minutes turning the retention question into an operator decision. These are three independent synthetic cases, each starting from the same fixture. They do not extend the CSV's timeline or describe the live platform. Keep your first decisions before opening the worked interpretation below.
The receiver accepts a scoped key at 09:00 UTC and commits ticket T-H at 09:02, but the caller loses its receipt. For this fixture only, the operation record expires sixty minutes after acceptance, at 10:00. It is available before that instant and absent at or after it. Expiry removes the replay record; it does not delete the destination ticket. The destination retains a separate audit record binding the trusted tenant, original operation reference, exact accepted payload and T-H. The ordinary client cannot read that audit record. No clocks drift in this exercise; actual services need an explicit time and retention contract.
| Independent case | Observation available to the operator | Your decision before comparison |
|---|---|---|
| H — before expiry | At 09:59, an authorized receipt-only lookup returns the stored result reference T-H. It cannot execute an action. | Record the confirmed effect and distinguish receipt retrieval from retrying creation. |
| I — exact boundary | At 10:00, the operation lookup returns “record not found.” The destination audit lookup is unavailable. The client offers a button to submit the same payload and key again. | Decide whether the button may execute and what the missing record proves. |
| J — independent reconciliation | At 10:05, the operation record is absent. An authorized receiving reviewer reads the destination audit: one committed ticket T-H is bound to the original operation and accepted payload. The requester has since lost create permission. | Record the result, decide whether creation or correction is authorized and identify the evidence safe to return to the requester. |
Write one row per case with observation time, expiry time, replay evidence, destination evidence, confirmed effects or unknown, next action and responsible role. Treat 10:00 as a boundary condition, not as “roughly an hour later.” Name the transition that ends the replay guarantee. A matching ticket title or approximate timestamp alone is not the supplied audit binding.
Worked interpretation — compare after your first decisions
In H, the stored receipt confirms the single committed ticket under the supplied contract. Retrieve and record it without another create request. The operation record remains available for only one more minute; that remaining time grants no authority for a new action.
In I, the missing replay record says nothing about whether a ticket exists. The fixture's earlier commit is known to the exercise author, but it is not observable to the operator at this decision point. The operator must preserve an unknown outcome, suppress renewed execution and request destination reconciliation. The original key has no demonstrated duplicate-prevention guarantee after expiry. A new key cannot repair that uncertainty either.
In J, the separately authorized destination evidence confirms one committed effect even though the replay record is gone. Close the uncertainty with the permitted result reference or a limited confirmation according to the requester's current read permissions. Do not return protected audit content merely because the requester remembers the key. Revoked create permission stays revoked. If the committed ticket needs changing, the receiving owner must authorize the destination's correction process; reconciliation itself authorizes neither a new ticket nor a correction.
Now replace J's audit result with “permission denied.” Revise only the conclusions supported by that observation. Denied access is not proof that the ticket is absent, and it does not erase a previously confirmed commit. Route reconciliation to a currently authorized receiving role, with no credential sharing or creation workaround.
Give the receiving operator a usable recovery note
Write the note for I in fewer than eighty words. Include the preserved operation reference, the expired replay window, the unknown destination outcome, the prohibited duplicate and the responsible receiving role. For example:
Receipt unavailable for OP-H. Its replay window ended at 10:00 UTC; the missing operation record cannot establish whether the destination committed. Do not create a replacement or retry creation. The authorized receiving reviewer must reconcile the original operation and accepted payload against the destination audit, then return only evidence the requester may see. Keep the outcome unknown until that evidence is available.
Ask a partner to handle the exact-boundary case from your note. Keep the first decision, comparison, access-denied revision and receiving response in the same portfolio packet. Record any help used. A successful tabletop response is practice evidence, not a measured recovery rate or permission to enable ticket creation.
Run the two-database proof lab
Optional 30 minutes · Python 3.11+ · Standard library · No accounts or network. Download the outbox replay companion, inspect it and run it in your own learning folder. It creates and removes two temporary SQLite files: the caller's intent/outbox and a separate destination's effects/receipts. A local child process commits at the destination, then deliberately exits before returning an acknowledgment. It never contacts a ticket service or enables a platform capability.
An outbox is delivery work stored with the caller's business intent in one transaction. That transaction does not include the separate destination commit. A replay receipt is the destination's retained binding between an operation and its result. For the guarded cases, the destination commits that receipt and the synthetic effect together. The two transactions still do not become a distributed transaction.
Spend five minutes predicting, ten running and inspecting, five changing a request and ten receiving a partner's evidence. Each case starts fresh. The diagram is an authored explanation, not a recording of your execution.
UNDERSTAND THE SYSTEM
Two commits. One missing acknowledgment.
Follow the companion's two local SQLite databases. These frames explain separately reset cases; the diagram does not run the code. Only the independent lab observer can inspect both stores. A pending caller cannot infer that the destination did nothing.
Watch one example, step by step.
Read the full worked example
- 01Retain intent before delivery
Caller intent and the pending outbox row commit together. This preserves work across the child failure. It does not yet establish a destination effect or make the two stores one transaction.
CALLER OBSERVATION: Pending · no receipt
- 02Commit, then lose the reply
The child commits one destination effect and exits 23 before returning its result. The independent lab observer finds one effect. The caller still has pending work and an unknown outcome; do not give it the observer's knowledge.
INDEPENDENT OBSERVER: 1 effect · caller still pending
- 03Redeliver to the naive destination
In the naive case, the controlled second delivery creates another effect. The caller can acknowledge the returned second receipt, but that receipt does not prove there was only one effect. This deliberately unsafe comparison is not an instruction to retry an uncertain real action.
NAIVE CASE · OBSERVER: 2 effects after redelivery
- 04Replay the guarded destination
Start the guarded case afresh. Its first effect and receipt commit atomically. After the same exit, redelivery with the same scope, key and payload returns that receipt without another effect. The caller can now acknowledge its original work.
GUARDED CASE · OBSERVER: 1 effect · original receipt replayed
- 05Reject a changed request
Start changed-payload afresh. The first result exists, but the altered retry conflicts with the stored payload. It creates no second effect and cannot acknowledge the original caller work. A new key would identify new work, not recover the missing result.
CHANGED PAYLOAD · OBSERVER: 1 effect · caller remains pending
Read the connections in plain English
- 01Caller intent → Pending outbox
Commit caller intent and delivery work together in one SQLite transaction.
- 02Pending outbox → Delivery child
Read the pending operation; delivery is a separate step after the caller commit.
- 03Delivery child → Destination contract
The child executes an operation in a separate local database, not in the caller transaction.
- 04Destination contract → Effect and receipt
The destination owns its effect and, when guarded, its atomic replay receipt.
- 05Effect and receipt → Caller acknowledgment
The first child exits before this acknowledgment. A later matching replay can return the original receipt.
Check your understanding: The outbox is pending and the child exited. How many destination effects can the caller claim?
Unknown from those observations alone. In the lab, an independent observer reads one committed effect; that knowledge is deliberately separate. Safe redelivery requires the destination's demonstrated replay contract for the original scoped key and payload within its retention policy. Otherwise preserve uncertainty and assign authorized reconciliation.
Predict, crash and redeliver
python3 --version
python3 fde-outbox-replay.py --all > outbox-results.json
python3 fde-outbox-replay.py --case guardedPredict the caller status and destination effect count separately before opening the output. The deliberately unsafe naive case makes the duplicate visible; do not copy its retry policy into a real uncertain operation.
| Fresh case | Change after the committed effect and lost acknowledgment | What to inspect |
|---|---|---|
naive | Deliver the same request again to a destination without a replay contract | Two effects; the second returned result cannot prove there was only one |
guarded | Deliver the original scope, key and payload again | One effect; the original receipt returns |
changed-payload | Alter the delivery copy while retaining the original caller intent | Conflict; one effect; original caller work remains pending |
scoped-key | Reuse the key under a different fixture scope | Separate work at the destination; it cannot acknowledge the original caller operation |
Read caller_after_crash before destination_observer_after_crash. The first is pending with no result; the second is an independent read of the destination. The caller's outcome stays unknown at the crash boundary. Inspect replay, caller_after_replay and destination_observer_after_replay to explain what changed and who could observe it. Do not copy the observer's count into a caller status as if it had received a receipt.
Find the deliberate child exit in the source and the two separate commit sites. The exit is coordinated by program order, not a timed guess. It follows an actual destination commit and precedes the child response. This proves that selected process-exit window on local SQLite; it does not measure host-loss durability, network behavior, concurrent traffic or a cloud database.
Change the request without rewriting the evidence
Preserve the original output. Compare guarded with changed-payload: the operation key alone cannot justify returning an earlier result for different work. The destination compares a SHA-256 fingerprint of canonical JSON as well as the scope and key. Reordered object keys produce the same fingerprint in this narrow schema; different business requests must not be treated as equivalent merely because their wording looks similar. The changed copy must not rewrite the caller's retained intent or mark it acknowledged. Inspect the implementation and identify the predicate that prevents that acknowledgment.
Now compare guarded with scoped-key. A key is meaningful within a scope; equal text in different scopes represents distinct operations in this fixture. Those scope labels are fixed synthetic inputs, not authentication. A real server must derive the scope from trusted identity and verify permission; accepting an arbitrary tenant field from a client is not that control.
Have a partner propose one counterfactual: the replay receipt has expired while the outbox is still pending. Explain why the demonstrated replay guarantee would no longer follow. This companion has no expiry engine and does not test that counterfactual. Retain an unknown outcome and assign authorized destination reconciliation instead of inventing a fresh key or deleting the pending work. Replay retention, ordering, concurrent admission, authorization and corrected effects need their own receiving contract.
Receive a recovery packet
Assign caller owner, destination owner and receiving engineer. For solo work, label the receiving check self-review. The caller owner locates the retained intent and missing acknowledgment. The destination owner identifies the atomic effect/receipt transaction and payload conflict. The receiver runs guarded and changed-payload without the author's narration, then locates evidence for each conclusion. Record assistance or takeover.
Candidate file / revision or digest:
My case and prediction before running:
Child exit observed / acknowledgment returned:
Caller record at the crash boundary:
Independent destination observation (not caller knowledge):
Replay request scope / key / payload change:
Returned result or conflict / caller state afterwards:
Destination effects before and after:
Exact source location of both commits and acknowledgment guard:
My contribution / assistance / receiving check actually performed:
Missing production contract / responsible owner / next check:Keep the naive duplicate as evidence of the failure, not a row to erase. The receiving team must establish destination replay and retention behavior, trusted identity, correction authority and operational lookup before relying on redelivery in an engagement. Completing this local exercise does not authorize deployment, establish independence or qualify a learner for placement.
Primary references checked 26 October 2026: AWS transactional outbox guidance describes duplicate delivery and idempotent consumers; SQLite transaction semantics explains the local commit boundary. The case, program and receiving exercise are original LockedIn Labs material.
Hand over the decision
Ask a partner to handle C using your runbook without asking you what “check it” means. The runbook should identify the actual kind of evidence needed, the responsible receiving role, the safe status to show and the condition for closure. For this fictional exercise, use role names and placeholders rather than invented production console links.
Keep three items in your portfolio: the trace with event references, your first and revised recovery tables, and the operator runbook. Record whether the receiver found the unknown state and avoided duplicate creation. An authored case or completed worksheet does not establish qualification, live reliability or a measured customer result.
Continue with the client-delivery workbook. Worked interpretations are in the Academy lesson “Rehearse shadow rollout, recovery and receiving-team handoff,” under existing training access.
A first agent-design exercise
If agent design and recovery are new, use the separate first-design and receiving worksheet. Allow 45 minutes plus setup; this is a foundation route rather than an extra requirement inside the 35-minute core packet. It introduces proposal, admission, intent, effect and acknowledgment, then compares the existing naive and guarded local cases before challenging changed payloads and scope. The four original cases need Python 3.11+ only, with no model, account, package installation or network.
The visual below explains those fresh cases. Both leave the caller unknown after a committed destination effect and lost reply. Naive replay can finish confirmed with two effects; guarded replay returns the original bound receipt with one. Keep the observer's direct database count separate from what the caller received. These are authored explanations of a local fixture, not your personal run or a provider guarantee.
Use the worksheet to keep each person's prediction, command, explanation and help, then let a receiving engineer locate the evidence without author takeover. Its final changed-contract task returns to the crash boundary before any matching acknowledgment: if replay evidence disappears, name the authorized destination reconciliation and safe manual path. Previously confirmed evidence stays in its own record. The deeper agent-design foundations lesson retains existing Academy access.
UNDERSTAND THE SYSTEM
An interrupted reply leaves two different views
Follow the existing local outbox lab. The caller's pending record and the destination's committed effect are different observations. A model proposal cannot fill the missing receipt.
Watch one example, step by step.
Read the full worked example
- 01A destination commit, then a missing reply
The child exits after the destination commit. The caller retains pending/unknown and no receipt. A separate observer reads one effect; do not silently give the caller that knowledge.
CRASH BOUNDARY: child exit 23 · caller unknown · observer 1
- 02Naive replay creates another effect
The same supplied delivery reaches a receiver without duplicate prevention. It returns a new receipt, and the caller becomes confirmed. The observer now sees two effects: confirmed does not mean exactly one.
NAIVE: 2 effects · caller confirmed
- 03Guarded replay returns the earlier result
The guarded destination recognizes the same scope, key and canonical payload. It returns its existing receipt without another effect, and the caller verifies that binding.
GUARDED: 1 effect · earlier receipt replayed
- 04Changed work does not close the original
In fresh cases, a changed payload under the old key conflicts and a different scope denotes separate work. Neither result can acknowledge the original caller intent. If replay records expire or lookup is unavailable before acknowledgment, this local success supplies no new guarantee.
CHANGED REQUEST: conflict or mismatch · original pending
Read the connections in plain English
- 01Proposed work → Caller record
Application admission and real authorization are deployment responsibilities; this lab supplies fixture scope.
- 02Caller record → Destination effect
The caller and destination use separate transactions.
- 03Destination effect → Destination receipt
Guarded destination replay binds the result to the scoped operation and accepted payload.
- 04Destination effect → Independent observer
An observer can read a committed effect without the caller having received anything.
- 05Destination receipt → Returned evidence
Only a receipt matching the retained intent may acknowledge the caller's original obligation.
Check your understanding: Why can a confirmed caller record still coexist with duplicate effects?
In the naive case the returned receipt confirms the second effect, while the earlier committed effect remains. Compare destination evidence, replay behavior and exact operation binding; do not infer uniqueness from the caller's final status alone.