Interface: Activation
Split a history into activations (C-HIST, spec 04 §2).
An activation is what one workflow task saw and did: the input events it delivered to the code, the clock it ran with, and (for completed tasks) the command events it appended. Replaying a history means running the code through the same activations in order and checking that each completed one issues the commands it recorded; the last, open activation then produces the new commands.
The rules:
- A boundary is a
WORKFLOW_TASK_STARTEDfollowed (input events may interleave) byWORKFLOW_TASK_COMPLETEDof the sametaskId. A Started followed by Failed or TimedOut is not a boundary; its inputs carry over. - Activation k delivers the inputs appended before its Started, up to the
history length the task was leased with (
payload.historyLength, written on transient attempts, else the Started event's own seq). - Inputs appended after that (while the task ran) belong to activation k+1.
- Command events after Completed(k) belong to activation k.
- The clock of activation k is
payload.startedAtof its Started event when present, else the event time. The open activation usesnowMs. - The history length activation k reports is its cutoff (rule 2); the open activation reports the leased length.
Properties
historyLength
historyLength:
number
The history length the task saw when it started (what ctx.info.historyLength
and continueAsNewSuggested report during the activation, so replay sees
the same values the original task did).
inputs
inputs:
RunEventRecord[]
Input events to deliver, in history order.
recorded
recorded:
RunEventRecord[]
Command events the task appended; undefined for the open (new) activation.
taskId?
optionaltaskId?:string
The completed task's id.
timeMs
timeMs:
number
The workflow clock during the activation.