Skip to content

fix: cancellation-aware failure semantics in finalize and on_failure handlers #38

Description

@joshua-temple

Problem

Two related correctness issues affect cascade's failure handling today:

1. Cancelled runs are not detected in failure checks.

The failure guard in the orchestrate workflow tests == 'failure' (generator.go:1004). With cancel-in-progress: true (the current default on orchestrate), a run superseded by a newer push enters cancelled state, not failure. The finalize job and any on_failure callbacks see cancelled as a non-failure state and skip — leaving the state file in whatever intermediate condition the cancelled deploy reached.

A deploy that progressed to 60% before cancellation should not silently leave the recorded state as "not deployed". Finalize and failure callbacks should treat cancelled as an actionable condition.

2. on_failure: continue does not suppress the run-level red status.

When a callback is configured with on_failure: continue, cascade currently has no way to emit continue-on-error: true on that specific job, so the overall workflow run still shows as failed even though the operator explicitly said the failure is acceptable.

What to fix

Cancelled detection: update the failure-check condition from == 'failure' to contains(fromJSON('["failure","cancelled"]'), ...) (or equivalent) in every generated failure guard. Finalize and on_failure callbacks should run on both failure and cancelled outcomes.

continue-on-error for on_failure: continue callbacks: when a callback has on_failure: continue, emit continue-on-error: true on its jobs.<id> block so the workflow run is not painted red.

Acceptance criteria

  • Failure-check conditions in generated workflows match on both failure and cancelled job outcomes.
  • The finalize job runs when any predecessor job was cancelled (not just when it failed).
  • on_failure callbacks run when a preceding job was cancelled.
  • Callbacks configured with on_failure: continue emit continue-on-error: true on the job.
  • A workflow run where all non-continue-on-error jobs succeed shows green even if a continue callback fails.
  • Existing golden tests updated; new unit tests cover the cancelled condition.
  • e2e scenario: a test triggers an orchestrate run, then immediately triggers a second run (causing the first to be cancelled mid-deploy); the first run's finalize job executes and records the cancelled state; the state file does not reflect a successful deployment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions