Workflows rollback handlers now include step context
Key Points
- ctx provides step metadata to rollback handlers
- rollbackConfig controls rollback retries and timeout
- output and error are passed to rollback for recovery
Summary
Workflows rollback handlers now receive the original step context via a ctx object for the step being rolled back. The ctx includes ctx.step.name, ctx.step.count, ctx.attempt, and the resolved step configuration (defaults applied). The step's rollbackConfig controls retries and timeout for the rollback handler itself.
Key Points
- Rollback handler signature receives
{ ctx, output, error }. Useoutputto access the step's returned value when undoing side effects. ctxexposes step metadata:ctx.step.name,ctx.step.count,ctx.attempt, and the stepconfig(including retry and timeout settings). Use these to customize recovery behavior.rollbackConfigon a step defines retry behavior and timeout for the rollback (e.g.,retries.limit,retries.delay,retries.backoff,timeout).- Practical usage: include step name and error in rollback reason, adjust retry/backoff based on
ctx.attempt, and inspect configured timeouts to avoid long-running rollbacks.
Refer to the Workflows rollback options docs for full API details and examples.