Skip to content

Mark job Failed when the runner shuts down during a composite step - #4891

Open
Akais24 wants to merge 1 commit into
actions:mainfrom
Akais24:fix-composite-shutdown-result
Open

Akais24 wants to merge 1 commit into
actions:mainfrom
Akais24:fix-composite-shutdown-result

Conversation

@Akais24

@Akais24 Akais24 commented Nov 26, 2026

Copy link
Copy Markdown

Fixes #4890.

When the runner receives a shutdown signal while a composite action step runs, CompositeActionHandler sets the job result to Canceled unconditionally. StepsRunner has chosen Failed on a runner shutdown since #1792. If the composite action has another step after the stopped one, that step's "job was already cancelled" branch runs last and the job ends cancelled.

This applies the same RunnerShutdownToken check in both places of CompositeActionHandler:

  • the job cancellation callback registered for each composite step;
  • the branch for a composite step that starts after the job token was already cancelled.

User cancellation still ends the job Canceled.

Reproduction: https://github.com/Akais24/runner-composite-shutdown-repro sends SIGTERM to Runner.Listener during a plain step, during the last step of a composite action, and during a composite step that has another step after it. On 2.338.2 the third job ends cancelled and the other two failure (runs 45765619032, 45765789878).

Testing: ./dev.sh layout and ./dev.sh test pass on osx-arm64. No L0 test was added: there is no harness that runs CompositeActionHandler.RunAsync with embedded steps, and #1792 added none for the StepsRunner change either. I can add one if you prefer.

I used an AI assistant to write this change and this description.

CompositeActionHandler set the job result to Canceled on any job
cancellation. StepsRunner has used Failed on a runner shutdown since
actions#1792. A composite step that runs after the stopped one hit the
already-cancelled branch and overwrote the result with Canceled.

Apply the same RunnerShutdownToken check in both places.

Fixes actions#4890

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Akais24
Akais24 requested a review from a team as a code owner November 26, 2026 06:50
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.

Runner shutdown during a composite action step ends the job cancelled instead of failed

1 participant