Durable execution
Authority: the semantic execution contract (F2) and the reactive activation contract (RAC) govern this chapter; it is operational and does not replace them.
A durable execution is opened once and kept alive across crashes by its journal. This chapter walks the operational cycle: opening, advancing, delivering activities, letting time expire what deserves expiry, recovering, and reading the journal from outside.
Open an execution
Take a .fsl program, elaborate it with the platform compiler, and seed the engine with the payload bytes plus the initial carrier state. The engine records the program’s identity from the exact source bytes, opens the journal, and writes the seeding event. From that moment the journal is the execution: the state lives in the carrier, but the authority to have arrived there lives in the record.
Advance the workflow
A tick evaluates the carrier and appends what the decision produced: the scheduled work, its start, and the tick’s own completion marker. Advance ticks explicitly; there is no wall clock hiding behind the engine, which is why every scenario in the conformance suite is deterministic. A tick that evaluates nothing records nothing, and a journal that never skips an ordinal is what lets recovery trust the gaps it does not find.
Deliver activities
When the workflow schedules an activity, a worker takes it from the pending queue. The take returns a delivery carrying the attempt generation, and the worker answers it with either a completion or a typed failure. The engine checks four things before it accepts anything: that the answer belongs to this execution, that the generation is the current one, that the attempt is still open, and that the task was actually delivered. Late, duplicate, foreign or never-delivered results are refused with distinct errors, and a refusal leaves the journal exactly as it was.
Let time expire what deserves expiry
Advancing the clock past an attempt’s deadline expires that attempt and records the contracted timeout event, then reschedules within the attempt ceiling and the total scheduling window, with linear backoff between attempts. Two boundaries matter in operation. When the total window closes, the open attempt expires at the boundary with the exhausted-window cause, even if its own deadline lies ahead. And an expired attempt’s answer can still arrive: it is refused, because the generation it carries is no longer current.
Recover from a crash
Reopen the execution from its journal. Closed segments replay in the original evaluation window, against the state seeded in the first event, and every decision must reproduce itself; a divergence seals the execution as non-deterministic and stops it. An open segment, one interrupted between start and outcome, resumes in place: the interrupted attempt is rescheduled by generation, nothing already delivered is redelivered, and the continuation carries the same identities. The crash test suite proves this shape on both journal backends.
Read the journal from outside
The reactive feed publishes every journal event as an occurrence: the position is the ordinal, the identity is the occurrence’s durable id, and the source name is declared, not invented. A consumer starts from a position and receives contiguous entries from there; if the underlying record has a hole, reading fails closed instead of skipping past it. A notification only becomes an activation candidate for consumers that declared the source, and the candidate passes a policy gate before any order exists.
Choose the backend
The journal accepts two keepers: SQLite in durable mode, for a single-file deployment, and the FormaKV engine, when the platform’s own persistence is already in the process. The conformance battery runs identically on both, so choosing is a deployment decision, not a semantics decision. The one rule that does not move: substrates never depend on the compiler; only the host does.