Honor mark_success for non-retryable exit codes
Merged
CJ
4d ago+64+64+01234567890123456789-13-13-01234567890123456789
Summary
- A step with
continue_on.mark_success: truewas still left failed when its failure ended the step without using all retries (for example, an exit code that does not matchretry_policy.exit_codes). - Root cause:
shouldRetryNodeset the node failed directly and returned, sohandleNodeExecutionErrornever reached themark_successbranch that promotes the node to succeeded. The Goswitchhas 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
finalizeFailedNodehelper socontinue_on.mark_successis applied consistently regardless of how the failure terminates.
Test plan
- Added a regression test in
internal/runtime/runner_test.gousing the issue's config: a non-retryable exit code withcontinue_on.exit_code: [0, 1]andmark_success: true→ node endssucceeded, retries not used. - Run
go test ./internal/runtime/(retry/mark_success cases pass; one unrelated Windows-onlyecho.exefile-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.
MatchExitCodenow returns false for setup failures.- Adds regression tests for a non-retryable exit code with
mark_successset and for a setup failure withcontinue_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.