Part 9 of 12 · 2 min read
Mistakes that lose runs or repeat charges
Common mistakes, and what the example does not do.
Mistakes that lose runs or repeat charges
- Restarting from scratch and repeating spend and effects.
- Journalling "step done" without the result, so replay cannot continue.
- No idempotency keys on effects, trusting the journal alone.
- Non-deterministic orchestration code (time, random, unordered iteration).
- Resuming old journals against new code.
- Holding a worker while waiting for a human.
- Compensations that are not idempotent or never tested.
- Unbounded journal growth on very long runs.
What the example does not do
About this example What the example does not do
- In-memory journal, single process: no real storage, ordering, concurrent writers or exactly-once journal writes.
- Crash positions are injected, not real process kills; partial writes and corrupted journals are not simulated.
- Probabilities and costs are assumptions.
- Idempotency is assumed to be honoured downstream; many real APIs do not support keys.
- No history versioning, patching or migration, only a refuse-to-resume hash.
- Compensation is a toy: real compensations can fail or be impossible.
- Optional real experiment: run a real agent under a durable engine or your own journal, kill the worker at random during runs in staging, and compare cost, duplicate effects and completion with a restart-on-failure setup.
Check yourself
A 7-step agent run crashes at step 5. What does restarting from scratch cost compared with resuming from a journal?
Show answer
Restarting cost 12.43 per run against 8.22 for resuming, and it repeated side effects 243 times. Resuming skips completed steps; an idempotency key stops the step in flight from running twice.
What you will use daily at work
| Practice | What it looks like |
|---|---|
| Journal each expensive or non-repeatable step | Replay reuses recorded results. |
| Key every external effect by run id and step | Retried steps then do nothing twice. |
| Record time and random values | Replay must follow the original path. |
| Version workflows with runs in flight | Keep old versions until old runs finish. |