fix: premature task completion when chaining multiple reusable workflows #1367

Merged
mfenniak merged 1 commit from syncstack/runner:fix/nested-reusable-workflow-task-finalization into main 2026-02-11 20:27:24 +00:00
Contributor

When a workflow calls a reusable workflow that itself chains two or more
reusable workflows sequentially, the runner incorrectly marks the overall
task as completed after the first nested reusable workflow finishes.

Example

# repo: my-project/.workflows/ci.yml
jobs:
  pipeline:
    uses: shared-workflows/.workflows/pipeline.yml@main
# repo: shared-workflows/.workflows/pipeline.yml
jobs:
  step-a:
    uses: shared-workflows/.workflows/step-a.yml@v1

  step-b:
    needs: [step-a]
    uses: shared-workflows/.workflows/step-b.yml@v1
    # ^ At first glance this appears to work — steps execute and logs
    #   are streamed — but the runner has already finalized the task
    #   after step-a completed. The log stream is silently writing into
    #   a task that Forgejo considers finished.
    #
    #   The problem becomes visible when step-b tries to interact with
    #   the Forgejo API (e.g. uploading artifacts, updating status):
    #   those calls fail with "task is not running" and artifacts are
    #   lost. The parent workflow also reports success regardless of
    #   what actually happened in step-b.
  • bug fixes
    • PR: fix: premature task completion when chaining multiple reusable workflows
When a workflow calls a reusable workflow that itself chains two or more reusable workflows sequentially, the runner incorrectly marks the overall task as completed after the first nested reusable workflow finishes. ### Example ```yaml # repo: my-project/.workflows/ci.yml jobs: pipeline: uses: shared-workflows/.workflows/pipeline.yml@main ``` ```yaml # repo: shared-workflows/.workflows/pipeline.yml jobs: step-a: uses: shared-workflows/.workflows/step-a.yml@v1 step-b: needs: [step-a] uses: shared-workflows/.workflows/step-b.yml@v1 # ^ At first glance this appears to work — steps execute and logs # are streamed — but the runner has already finalized the task # after step-a completed. The log stream is silently writing into # a task that Forgejo considers finished. # # The problem becomes visible when step-b tries to interact with # the Forgejo API (e.g. uploading artifacts, updating status): # those calls fail with "task is not running" and artifacts are # lost. The parent workflow also reports success regardless of # what actually happened in step-b. ``` <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1367): <!--number 1367 --><!--line 0 --><!--description Zml4OiBwcmVtYXR1cmUgdGFzayBjb21wbGV0aW9uIHdoZW4gY2hhaW5pbmcgbXVsdGlwbGUgcmV1c2FibGUgd29ya2Zsb3dz-->fix: premature task completion when chaining multiple reusable workflows<!--description--> <!--end release-notes-assistant-->
fix(ReusableWorkflowRunner): skip banner for nested reusable workflows
All checks were successful
checks / validate pre-commit-hooks file (pull_request) Successful in 33s
checks / Build Forgejo Runner (pull_request) Successful in 37s
checks / validate mocks (pull_request) Successful in 38s
checks / Build unsupported platforms (pull_request) Successful in 20s
checks / runner exec tests (pull_request) Successful in 26s
checks / integration tests (docker-latest) (pull_request) Successful in 7m46s
checks / integration tests (docker-stable) (pull_request) Successful in 10m15s
issue-labels / release-notes (pull_request_target) Successful in 4s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 23s
132bb2aa27
syncstack changed title from WIP: fix premature task completion when chaining multiple reusable workflows to fix premature task completion when chaining multiple reusable workflows 2026-02-11 06:28:56 +00:00
syncstack changed title from fix premature task completion when chaining multiple reusable workflows to fix: premature task completion when chaining multiple reusable workflows 2026-02-11 06:29:32 +00:00
Contributor

cascading-pr updated at actions/setup-forgejo#882

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/882
mfenniak approved these changes 2026-02-11 20:27:09 +00:00
mfenniak left a comment
Owner

Looks good to me! Thanks.

Looks good to me! Thanks.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1367
No description provided.