research28 min studyLesson 883 in Engineering

Step journals: replay recorded decisions without rerunning the outside world

Define immutable event records, artifact references, deterministic control replay, and recovery for unresolved tool intents.

On this page

What you’ll understand

  • Reconstruct a run from accepted ordered events.
  • Record nondeterministic model and tool results as replay inputs.
  • Distinguish journal integrity from external-effect completion and artifact availability.

A durable journal turns recovery into an explicit reconstruction problem. It records what the runtime decided, what it requested, and what it actually learned about the result. Replay should consume recorded outcomes rather than ask a model or external service to recreate the past. The difficult boundary is an intent whose external effect may have happened before its completion was recorded.

Journal events describe facts at precise boundaries

A proposed journal can append intent, dispatch, result-observed, effect-confirmed, approval, budget, and terminal events with stable identities. Define which transitions share a storage transaction and which merely follow one another. Append corrections or reconciliation findings instead of silently rewriting an old success into a failure. Include logical step, attempt, incarnation, expected revision, contract version, and references to the relevant inputs and outputs. An application log line is not automatically a durable accepted event.

Store large artifacts through immutable versioned references with integrity metadata and an availability policy. A digest can detect a changed payload when compared against a trusted record, but it cannot recover a missing payload. Retention and access controls must cover the artifacts required for recovery. A redacted diagnostic trace and a complete execution record can serve different purposes. State what information is replay-critical and how its deletion or expiration changes the supported recovery window.

Sn=fold⁡(δ,S0,[e1,…,en])S_n=\operatorname{fold}(\delta,S_0,[e_1,\ldots,e_n])
The proposed reconstruction applies a versioned deterministic reducer δ to an accepted ordered event prefix. It assumes the needed artifacts and compatible code remain available. It does not infer unrecorded remote effects or make event append and external execution one transaction.↔ Scroll wide equations horizontally.

Determinism concerns the recorded command history

A model response is a nondeterministic external result for replay purposes. Preserve the actual response and its artifact identity, along with model, prompt, tool-schema, and decoding configuration. A fixed seed or zero temperature does not guarantee a future provider invocation returns identical bytes under changed infrastructure or model revisions. Likewise, wall-clock reads, random values, network lookups, and scheduler order need recorded inputs or workflow-safe APIs when they affect control decisions. Do not turn a replay into a new planning run silently.

Temporal's documented replay compares generated commands with its Event History under deterministic constraints. That is a concrete platform mechanism, not a promise that arbitrary application code can replay safely. Code changes need the platform's supported compatibility or versioning strategy. In the proposed journal design, define equivalent rules for reducer and schema evolution. A hash chain can assist integrity checking, but an untrusted actor able to replace the whole chain and its root is not defeated by hashes alone; use a trusted anchor and access policy.

hi=H(hi−1,canon⁡(ei))h_i=H(h_{i-1},\operatorname{canon}(e_i))
This optional journal-integrity construction hashes a canonical event encoding and prior digest. Its usefulness assumes collision-resistant hashing, stable canonicalization, and a trusted retained anchor. It does not prove event truth, prevent every authorized mutation, or guarantee artifact availability.↔ Scroll wide equations horizontally.

An unresolved intent requires effect-aware recovery

If the journal contains a tool intent but no confirmed outcome, determine whether dispatch occurred and whether the provider can resolve the logical operation. Use a stable idempotency key, provider receipt lookup, conditional resource state, or another implemented reconciliation path. Replaying a recorded completion should not repeat its external write. Retrying an unresolved intent with a new identity can create a duplicate. Test crashes before dispatch, after provider commit, and before journal append rather than assuming the same handler exception covers every window.

The cache lab models only the performance of retaining a small working set. Reset, set C=3 and s=4, predict zero initial hits in sixteen requests, then Play or Step. Separately Reset, set C=4 and s=4, predict twelve, then Play or Step. A workflow state cache can reduce reconstruction work, but this toy LRU stream has no journal or durable storage. Evicting a cache entry is different from losing its authoritative history; validate replay from the durable record even after every in-memory entry is gone.

Reconstruct two completions and one unresolved intent

A proposed journal records intent and completion for step A, intent and completion for B, then intent for C. It has five ordered events. The worker crashes after C may have reached its provider.

  1. Replay folds all five accepted events and reconstructs two confirmed step results, A and B.

  2. Neither recorded completion is a reason to call its external tool again. C remains one unresolved intent rather than a third confirmed result.

  3. Reconcile C using its stable effect identity and provider evidence. If a completion is confirmed, append the next accepted event at sequence six under the store's concurrency rule; do not invent that result from the missing journal entry.

The result

Five events establish two known completions and one unresolved effect boundary, not permission to rerun every step.

Explore the model

Interactive lab

Interactive lab · cache

A fast state cache is not the durable journal

Reset, set C=3 and s=4, predict zero initial hits in 16 requests, then Play or Step. Separately Reset, set C=4 and s=4, predict 12 initial hits, then Play or Step. The modulo-16 LRU model has no event history, replay engine, integrity hashes, or remote effects.

A fast state cache is not the durable journalA fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Current readings: Hits / requests: 0 / 16; Hit rate: 0%; Address-stream period: 16 addresses. All parameters are adjustable with the labeled controls below.Fully associative LRU cache after 16 deterministic requests: 0 hits and 16 misses.Most recent 16 requestsaddress = i × 3 mod 160M3M6M9M12M15M2M5M8M11M14M1M4M7M10M13MCurrent cache order · oldest → newest471013Latest address 13 · miss: inserted as newestToy address stream · period 16 · starts empty
Cached addressMiss / evictionMost recent request
Hits / requests
0 / 16
Hit rate
0%
Address-stream period
16 addresses
t = 0 s

A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forRecovery must work from authoritative history even when an in-memory cache is empty.

Check your understanding

Why should replay consume a recorded model response instead of invoking the model again with the same prompt?

Try it yourself

Ten sequential steps each have one intent and one completion event, except the last has no completion. Count journal events, confirmed steps, and unresolved intents.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Count nine complete pairs plus the final intent.

Compare with the solution

There are 9×2+1=19 events, nine confirmed steps, and one unresolved intent. The missing completion does not prove the tenth external effect was absent. Recovery needs the declared provider and journal protocol, not a new uncorrelated retry.

Take it with you

  • Replay needs recorded nondeterministic results and compatible reducers.
  • Journal integrity, artifact availability, and effect truth are separate properties.
  • Unresolved intents require reconciliation across the external boundary.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.