Open-Source Wikis

/

Temporal

/

Primitives

/

Mutable state

temporalio/temporal

Mutable state

The mutable state of a workflow execution is the persisted-and-cached summary the History service uses to make decisions about the workflow without replaying its full event history.

Aspect Detail
What it holds In-progress activities, timers, child workflows, signals, queries, updates, callbacks, Nexus operations, retry state.
Storage One row per execution in the persistence backend's executions table.
Cache Per-shard LRU; entries are evicted when memory pressure rises.
Concurrency Per-execution mutex held in workflow.Context.
Update model Optimistic — every write increments a version stamp; concurrent writers fail with ConditionFailedError and reload.
Implementation MutableStateImpl — the largest hand-maintained file in the repo (~357KB).

Code references

Why the summary?

In principle, every workflow decision could be made by replaying the History Events from scratch. In practice this would be too slow — even modest workflows accumulate thousands of events. Mutable State is the cached, structured summary that supports O(1) lookups for "is this activity still in flight?" and similar questions.

Where to read more

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Mutable state – Temporal wiki | Factory