Skip to content

Conversation

@aashmanVerma
Copy link

Add cancellation checks in success/failure callbacks to prevent sending COMPLETED/FAILED events when a task is cancelled. This ensures cancelled tasks are properly marked as CANCELLED and not retried.

Description

When a TypeScript task is cancelled, the worker was incorrectly sending status updates (COMPLETED or FAILED) to the Hatchet engine. This caused cancelled tasks to be marked as either succeeded or failed (with retries), instead of being properly marked as CANCELLED.

The fix adds cancellation checks in both the success() and failure() callbacks before sending status events. When a task is cancelled, the worker now suppresses status updates, allowing the engine to properly handle the CANCELLED state. This matches the Python SDK behavior.

Fixes #2655

Type of change

  • Bug fix (non-breaking change which fixes an issue)

What's Changed

  • Added cancellation check in success() callback to suppress COMPLETED events when task is cancelled
  • Added cancellation check in failure() callback to suppress FAILED events when task is cancelled
  • Aligns TypeScript SDK behavior with Python SDK
Add cancellation checks in success/failure callbacks to prevent sending
COMPLETED/FAILED events when a task is cancelled. This ensures cancelled
tasks are properly marked as CANCELLED and not retried.
@vercel
Copy link

vercel bot commented Dec 19, 2025

@aashmanVerma is attempting to deploy a commit to the Hatchet Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant