Skip to content

Runs and History

A workflow run is one execution of a version-pinned definition. The graph engine called this an instance. The durable runtime does not keep tokens or a live Dart future.

What a Run Stores

  • workflow code, version, and digest;
  • status: running, blocked, completed, failed, cancelled, or continuedAsNew;
  • optimistic revision;
  • input, terminal output or error;
  • tenant, application, subject, starter, and idempotency key.

Progress is the immutable history plus the current command projection.

History

workflow_events is append-only and ordered by (run_id, sequence):

  • workflowStarted
  • activity scheduled / completed / failed
  • user task created / completed / expired
  • signal received
  • timer fired
  • cancellation, retry, redrive
  • workflow completed / failed / continued as new

Replay reads this sequence. Events are never edited in place. Retention archives a complete history as a unit.

Commands

Commands are obligations, not facts:

TypeWaits for
activitya leased worker
user taskan assigned actor
signalan external message
timerdurable time
workflow spawna child run

Statuses are pending, claimed, completed, failed, or cancelled. Unique (run_id, operation_key, attempt) prevents duplicate emission during replay.

Continue as New

Long histories close the parent and create exactly one successor in the same transaction. Signals, cancel, redrive, and queries sent to an older run ID resolve the active generation. History reads stay generation-specific so audit evidence is never silently merged.

Queries

Workflow.query exposes a read-only snapshot from current bindings. A query cannot append history, schedule work, or consume runtime IDs.

See Also