Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Jan 6, 2026

Add whenFailed option for error handling after retries are exhausted

This PR adds a new whenFailed option to control what happens when a task fails after all retry attempts are exhausted. The option supports three modes:

  • fail (default): Marks the step and run as failed, stopping execution
  • skip: Marks the step as skipped and continues the run
  • skip-cascade: Marks the step as skipped and also skips all downstream dependent steps

Implementation details:

  • Added when_failed column to the steps table with appropriate constraints
  • Enhanced fail_task function to handle the different failure modes
  • Added support for whenFailed option in the TypeScript DSL
  • Created comprehensive tests for all three failure modes
  • Ensured type violations still cause hard failures regardless of whenFailed setting

This feature provides more flexibility in error handling, allowing workflows to continue execution even when non-critical steps fail.

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: c25ab9f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@pgflow/core Patch
@pgflow/dsl Patch
pgflow Patch
@pgflow/client Patch
@pgflow/edge-worker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Jan 6, 2026

View your CI Pipeline Execution ↗ for commit c25ab9f

Command Status Duration Result
nx run edge-worker:test:integration ✅ Succeeded 3m 51s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 3s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 3s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 2m 17s View ↗
nx run client:e2e ✅ Succeeded 1m 9s View ↗
nx run cli:e2e ✅ Succeeded 3s View ↗
nx run edge-worker:e2e ✅ Succeeded 47s View ↗
nx run core:pgtap ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-08 11:31:09 UTC

@jumski jumski force-pushed the 01-05-add_condition_evaluation_in_start_ready_steps_and_dsl_support branch from 5e8c404 to c68bf9c Compare January 6, 2026 18:17
@jumski jumski force-pushed the 01-05-add_whenfailed_option_for_error_handling_after_retries_exhausted branch from ccaa5de to 46b2302 Compare January 6, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants