Continue as New and Terminals
A Dart workflow starts at execute and ends by returning a result, throwing a permanent failure, cancelling, or calling continueAsNew. JSON documents use end and continueAsNew steps.
Terminal Statuses
| Status | Meaning |
|---|---|
completed | Returned a result |
failed | Permanent failure after retries or an unhandled error |
cancelled | Operator or business cancellation |
continuedAsNew | Parent closed; successor holds the next history |
Cancel and fail are first-class terminals. They reach pending work and attached spawned runs.
Continue as New
Histories are bounded. WorkflowRuntimeOptions suggests continue-as-new at a soft limit (continueAsNewSuggestedAt, default 10,000 events) and fails at the hard bound (maxHistoryEvents, default 50,000).
dart
if (workflow.continueAsNewSuggested) {
workflow.continueAsNew({...input, 'generation': generation + 1});
}The parent close, successor creation, lineage links, and successor workflowStarted event are one storage transaction. Lineage is acyclic. Commands addressed to an older generation resolve the active successor.