Honor mark_success for non-retryable exit codes

Merged
CJ
4d ago
+64-13

Summary

  • A step with continue_on.mark_success: true was still left failed when its failure ended the step without using all retries (for example, an exit code that does not match retry_policy.exit_codes).
  • Root cause: shouldRetryNode set the node failed directly and returned, so handleNodeExecutionError never reached the mark_success branch that promotes the node to succeeded. The Go switch has no fallthrough, so the shared branch was skipped entirely.
  • Fix: route the non-retryable exit code path and the unrecoverable-error path through a shared finalizeFailedNode helper so continue_on.mark_success is applied consistently regardless of how the failure terminates.

Test plan

  • Added a regression test in internal/runtime/runner_test.go using the issue's config: a non-retryable exit code with continue_on.exit_code: [0, 1] and mark_success: true → node ends succeeded, retries not used.
  • Run go test ./internal/runtime/ (retry/mark_success cases pass; one unrelated Windows-only echo.exe file-lock cleanup failure is pre-existing and environment-specific).

Closes #3539

Signed-off-by: CJstate 1507965754@qq.com


Summary by cubic

Fixes continue_on.mark_success being ignored when a step fails with a non-retryable exit code, and stops continue_on.exit_code from matching steps that never ran.

The non-retryable path returned early and never reached the success-promotion logic; now both it and the unrecoverable-error path go through a shared finalizeFailedNode helper so mark_success applies consistently. Setup failures no longer match continue_on.exit_code, since a step that never runs keeps its default exit code of 0.

  • MatchExitCode now returns false for setup failures.
  • Adds regression tests for a non-retryable exit code with mark_success set and for a setup failure with continue_on.exit_code. Closes #3539.

Summary by CodeRabbit

  • Bug Fixes
    • Workflow steps now consistently apply configured failure-handling behavior when a command fails without being retried. When configured to continue and mark the step successful, the step and its dependent steps can complete successfully. Otherwise, the step remains failed and its execution error is recorded.
    • Setup failures are not treated as matching configured exit codes, even when the failure-handling rules include those codes.