Context
When a step callback throws due to AbortSignal cancellation, the current code records it as a failed step (status: 'failed') and emits step:fail. This makes cancelled steps indistinguishable from genuinely failed steps in step-level telemetry.
Raised in #37 review: #37 (review)
Idea
In the step.run() catch block, detect if controller.signal.aborted and handle it differently:
- Record the step with a
cancelled status instead of failed
- Emit a
step:cancel event instead of step:fail
- Rethrow as
CancelledError
Considerations
- Requires adding
cancelled to the step status enum (schema change)
- Need a new
step:cancel event type
- Should be backward-compatible (existing
step:fail listeners won't break)
- Consider whether
AbortError from user code (e.g. fetch) should also be treated as cancellation
Related
Context
When a step callback throws due to AbortSignal cancellation, the current code records it as a failed step (
status: 'failed') and emitsstep:fail. This makes cancelled steps indistinguishable from genuinely failed steps in step-level telemetry.Raised in #37 review: #37 (review)
Idea
In the
step.run()catch block, detect ifcontroller.signal.abortedand handle it differently:cancelledstatus instead offailedstep:cancelevent instead ofstep:failCancelledErrorConsiderations
cancelledto the step status enum (schema change)step:cancelevent typestep:faillisteners won't break)AbortErrorfrom user code (e.g.fetch) should also be treated as cancellationRelated