Workflow versioning

On this page 7

Workflow versioning is the practice of assigning an explicit, immutable version to each revision of a workflow definition so that running instances keep executing the logic they started with while new instances adopt the updated logic. In automation, it is a core reliability technique, because long-running processes often outlive the code that launched them.

Without versioning, a deployment that changes a step, a branch condition or a data contract can break instances that are paused mid-flight, waiting on a durable timer, a human approval or an external callback. Versioning turns a risky in-place change into a controlled coexistence of old and new definitions.

Why long-running workflows need explicit versions

Workflows need explicit versions because their lifetime can span hours, weeks or months, while the definition behind them may change several times a day. A stateless API call finishes in milliseconds, so a new release simply serves the next request. A workflow instance, by contrast, carries persisted state and a position in its process graph, and both must remain meaningful after a release.

The danger is most acute in durable execution engines that rebuild state through workflow replay. On recovery, the engine re-executes the workflow code against the recorded event history and expects the same sequence of commands. If the code now schedules a different activity at step four, the engine detects a non-deterministic replay error and the instance stalls. Versioning keeps the replayed path identical to the recorded path.

The table below summarizes what can change in a workflow and how each change affects instances already in progress.

Change typeExampleRisk to in-flight instances
Additive step at the endAdd a notification after completionLow if the engine tolerates new commands
Step reorderingMove a credit check before validationHigh, replay diverges from history
Branch condition changeRaise an approval thresholdMedium, decisions may differ on replay
Activity signature changeRename an input fieldHigh, payloads fail deserialization
Timeout or retry policy changeExtend a timer from 2 to 5 daysMedium, depends on where state is stored
Removed stepDrop a legacy archive callHigh, history references a missing command
Types of workflow change and their impact on running instances

Common versioning strategies

Engines and platforms implement workflow versioning through a small set of recognizable strategies. The choice depends on whether the platform pins instances to a definition, supports in-code version branches, or routes traffic between parallel deployments.

StrategyHow it worksTypical fit
Definition pinningEach instance stores the version ID it started withBPMN engines, low-code platforms
Patch markers in codeA version or patch call branches old and new logicCode-first durable execution engines
Worker versioningInstances route to worker builds that match their versionLarge fleets with frequent releases
Side-by-side workflow typesA new workflow name replaces the old oneBreaking redesigns of a process
Instance migrationRunning instances are moved to a new definitionSimple state models with mapping rules
Main workflow versioning strategies compared

Definition pinning is the default in most orchestration platforms: the engine keeps every deployed revision and resolves each instance against its own revision. Patch markers suit code-first engines, where a developer wraps changed logic in a version check so that replay of old histories follows the old branch. Worker versioning shifts the problem to deployment, keeping old worker builds alive until their instances drain.

Instance migration is the most powerful and the most dangerous option. It requires an explicit mapping from old state to new state, and it should be tested against a sample of real histories before it touches production instances.

Workflow versioning is often confused with general software versioning and with neighboring reliability patterns, but it solves a narrower and more stateful problem. The comparison below clarifies the boundaries.

ConceptPrimary question it answersRelation to workflow versioning
Semantic versioningIs this release compatible for callersLabels releases but does not protect running instances
API versioningWhich contract does a client useSimilar idea, applied to stateless requests
Workflow replayHow is state rebuilt after a crashVersioning keeps replay deterministic
CheckpointingWhere can execution resumeCheckpoints must match the version that wrote them
Saga patternHow are distributed steps compensatedCompensations must match the version that ran
How workflow versioning differs from related concepts

The practical consequence is that a team can follow semantic versioning for its worker libraries and still break production workflows. Only a mechanism that ties each instance to a specific logic revision prevents that failure.

Designing a safe versioning process

A safe process treats every change to a workflow definition as a potential breaking change for in-flight work until proven otherwise. The following practices reduce that risk in day-to-day operations.

  • Make definitions immutable once deployed; publish a new version instead of editing an existing one.
  • Record the version identifier on every instance and expose it in workflow monitoring dashboards.
  • Run replay tests against recorded production histories before each release of a code-first workflow.
  • Keep activity inputs backward compatible by adding optional fields rather than renaming or removing them.
  • Define a retirement policy: remove an old version only when its instance count reaches zero.
  • Document why each version exists, so that operators can judge whether a stuck instance needs migration.

The decision table below helps choose a strategy for a given change.

SituationRecommended approachReason
Small fix, few running instancesPatch marker or new pinned versionLow cost, old path remains replayable
Major redesign of the processNew workflow type side by sideAvoids complex branching in one definition
Urgent bug affects running instancesTested instance migrationPinning alone would preserve the bug
Thousands of long-lived instancesWorker versioning with drain monitoringIsolates releases without code branches
Choosing a versioning approach for a planned change

Limitations and common mistakes

Versioning has real costs. Every retained version is code that must still compile, deploy and be understood, and accumulated patch branches make a definition hard to read. Teams that never retire old versions end up with version sprawl, where a single workflow file contains a dozen historical branches.

Typical mistakes include editing a deployed definition in place, assuming that adding a step is always safe, and forgetting that external dependencies also change. An old version may still call an endpoint or a queue that has since been retired, so the contracts of downstream services need their own compatibility window. Another frequent error is testing new versions only with fresh instances, which never exercises the replay of old histories.

Finally, versioning does not replace idempotency or a sound retry policy. It guarantees that an instance follows consistent logic, not that each step is safe to repeat after a partial failure.

A non-technical view

Imagine a recipe that a restaurant changes while some dishes are already half cooked. The cooks who started with the old recipe should finish with the old recipe, or the dish will come out wrong. Workflow versioning does the same for automated processes. Every process remembers which version of the instructions it started with and finishes on that version.

New processes pick up the improved instructions. Old ones are allowed to finish quietly, and the old instructions are thrown away only after nobody uses them anymore. The result is that updates no longer break work already in progress.

A concrete example

An insurance company runs a claims workflow that waits up to 30 days for supporting documents before assessment. About 4,000 claims are in that waiting state when the operations team decides to add a fraud screening step before assessment and to rename one input field of the assessment activity.

Instead of editing the live definition, the team deploys the change as version 7 and keeps version 6 registered. New claims start on version 7, while the 4,000 waiting claims continue on version 6 and skip the new screening step. Before release, the developers replay 500 recorded production histories against the new code to confirm that no version 6 history diverges. The assessment activity accepts both the old and the new field name for the transition period.

Over the following five weeks, the version 6 instance count falls to zero on the monitoring dashboard, and the team removes the old branch. No claim stalled or failed during the rollout, and the fraud check covered every claim opened after the release.