Part 5 of 13 · 2 min read
A long pause means resuming on information that may already be wrong
Think of picking up a grocery list you wrote three days ago. The store may be out of an item you listed, or it may now be on sale. The list itself has not changed. But the world the list was written against has moved on without it.
In plain words: stale state is saved assumptions that the outside world has since changed, and the longer a run is paused before resuming -- waiting on a person, a slow approval, an external event -- the more likely it is that something the plan depends on (an order's refund status, a price, an account balance) has already changed underneath it, which means a resume has to treat its saved facts as a hypothesis to check, not as ground truth.
A worked example. With an assumed 2% chance per hour that some relevant fact changes, a 1-hour pause resumes on a false premise 2.2% of the time; a 6-hour pause, 11.5%; a 24-hour pause, 38.4%; a 72-hour pause, 76.6%. The closed-form estimate (1 minus 0.98 to the power of hours) agrees closely -- 0.39 at 24 hours against the simulated 0.384 -- confirming the simulation isn't an artifact of the particular random trials run.
The key lines. From code/mini-durable/durable.py:
# from code/mini-durable/durable.py
def stale_rate(pause_hours, hazard=0.02, revalidate=False, trials=20000, seed=1):
"""A paused run is resumed after pause_hours. Each hour the premise (e.g. 'order is unrefunded')
is invalidated with probability `hazard`. Return the share of resumes that act on a false premise."""
rng = random.Random(seed)
bad = 0
for _ in range(trials):
stale = any(rng.random() < hazard for _ in range(math.ceil(pause_hours)))
if stale and not revalidate:
bad += 1
return bad / trials
Read it as: any(rng.random() < hazard for _ in range(...)) checks whether the premise broke at any hour during the pause, not just at the final moment. This is the right way to model staleness. The premise only needs to flip once during the whole wait to make the eventually-resumed action wrong. That is exactly why risk compounds with pause length. It does not depend only on how things stand right at resume time.
Stale state
Stale state is saved assumptions that the outside world has since changed.
Example: 76.6% of 72-hour pauses acting on a false premise in this model is the concrete number behind the design rule "re-validate on resume" -- at that pause length, re-checking the premise before an irreversible step is closer to mandatory than optional.