Skip to content

feat: distinguish cancelled steps from failed steps in telemetry #39

@coji

Description

@coji

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions