Skip to content

Chapter 17 · agent-neuron · Lab

Refunds

Large refunds wait for a person, a resubmit never cuts a payment, a payment nobody can vouch for is unknown, and a reconcile run asks the ledger.

Paying is an effect

Seven refunds arrive. The small ones pay on their own; the three above fifty wait on the manager’s desk, because the network file declares the paying neuron an effect: the run’s one irreversible class of call, marked with a flag wherever the run is drawn.

One refund is sent again while its first payment is still going. The payment is not cut; its answer is recorded, marked not forwarded, and goes nowhere downstream; and the duplicate returns the first payment’s receipt, so the take shows one payment and one receipt. Another pays, then loses its connection after the money moved: its outcome is unknown, not an error, because nobody can say whether it happened. A reconcile run then asks the ledger (the source the file declares for exactly that), reads the refund as paid, and answers: do not pay again.

The rule it proves

The effect half is SPEC 11 (decision 0007): staleness never cuts a started call, the record keeps the answer with forwarded: false (11.2), and every failure after a call started is unknown rather than an error (11.3), so nothing downstream reads it as safe to do again.

The reconcile half is 11.4’s pattern, informative on purpose: the file declares a source and a lookup neuron, whoever saw the unknown injects the id, and the answer is the record. The engine itself never retries, never holds a key and never waits; the demo is the pattern carried out, not engine machinery.

Run it

npm run demo refunds -- --headless --pace 3  # the seven refunds, then the reconcile run
CommandFrom the demos repo’s root. The effect carries its flag wherever the run is drawn, and the reconcile run follows in the same command.

What it is not

Not a payments provider: the refunds, the ledger and the crash are invented, no card or account moves anything, and the receipts are the run trace’s own.

overfocus/agent-neuron