Open and answer this issue on GitHub.
decision · opened 2026-11-12 · updated 2026-11-12 · 0 comments
An outside consultancy made suggestions to the owner on 2026-11-12. This is one of them: a replay mode that records all effects of a run (file reads, network answers, clock, random numbers, AI calls) so that any run, including a failure in production, can be replayed exactly, for debugging and for audit. No ADR and no issue covers it.
A program run is reproducible when the same code given the same inputs does the same thing. Most runs are not reproducible, because they read things from outside: the clock, random numbers, files, the network, environment variables, standard input, and the order in which tasks are scheduled. A bug that shows up once in production may never show up again on the developer’s machine.
Record and replay fixes this. In record mode the runtime writes every value that comes in from outside to a log. In replay mode it reads them back from the log instead of from the world, so the run repeats exactly, step for step. This makes a production failure reproducible, a test of the failure a matter of keeping its log, and an audit able to show exactly what a program saw.
The question: should Nikaia offer a record-and-replay mode? If so, at which boundary are inputs recorded, how is concurrency made replayable, and what is promised: an exact replay, or a best effort?
file, net, stdin, args, env, clock(wall), clock(mono), random, process, native, …). Every way in which outside data enters a program already has a named kind, and a call that reads outside data goes through std under that kind. That is exactly the boundary to record. A program whose permissions are proved (#1432) cannot read the world any other way, except through native.These facts are from memory, not checked.
| System | How |
|---|---|
| rr (Mozilla) | records a Linux process at the system-call level and replays it under a debugger, with reverse execution. It works for any language, but runs on one core and needs hardware counters |
| Boruna | records effects in an audit log as part of its capability model (as far as I know) |
| Temporal, Azure Durable Functions | workflow code must be deterministic. Every side effect is an “activity” whose result is recorded and replayed when the workflow resumes |
| Elm | the time-travelling debugger replays the messages of a pure program |
| Haskell, Koka, Unison | effect handlers make swapping the real world for a recorded one a library matter |
| AILANG | describes deterministic replay of effects as a goal (not verified) |
| Vera, Dafny, Mojo | none that I know of |
std, at the permission boundary. nikaia run --record LOG makes every std call that reads outside data (by the #1433 kinds) append its result to the log. nikaia run --replay LOG returns the values from the log instead. With tasks, the scheduler records its order, or runs single-threaded and deterministic under replay. A program using native cannot be replayed exactly, and the tool says so.
nikaia test from a recording). An AI call is net, so it is recorded like any other answer.std, and the log may hold secrets (environment variables, network answers), so it needs a redaction story. The scheduler’s order has to be pinned.nikaia test replays it. There is no production record mode.
Option 2, scoped after #1433 is built, because it needs the vocabulary to name what to record. Promise an exact replay only for programs without native, and with the scheduler pinned. Treat the log as sensitive by default: no environment variables recorded unless asked, and a redaction hook. Ship option 3 (a recording as a test fixture) as its first user.
std’s input paths (file, net, clock, random, env, args, stdin, process), the task runtime, and the nikaia run / nikaia test commands in Part III (30-nikaia-tooling.md).