Skip to content

Fix: Retry the artefact download #295

Done

Description

Wait for #293. Its pull request, #294, adds a job to
.github/workflows/testing.yaml, and this repository takes one change
at a time. Start once that has merged.

Summary

The action downloads the build artefact by name and fails on the first lookup that finds nothing. Since 21 November GitHub's artefact service can fail to list an artefact for a second or two after its upload, so a download that follows an upload in the same job often fails although the artefact exists. Retry the download a bounded number of times before failing.

This repository's tests are the visible casualty. They build, or upload a fixture, and then audit in one job: 8 of the 12 test runs since the onset failed on this, among them all four pushes to main. A caller that builds and audits in one job is exposed in the same way. python-workflows is not, because its audit job runs after its build job.

Line numbers are from 965bc9b on main.

Evidence

Twelve downloads missed, in eight runs. Each came within 2.2 s of the upload it followed, and each artefact was in its run's list afterwards.

Job Misses Gap after the upload
Test Custom Artefact Name 6 0.30–0.46 s
Test No Wheels Guard 3 0.32–1.07 s
Run Tests 🧪 3 1.73–2.20 s

The runs: 44910286262, 45210544160, 45215109014, 45218678979, 45226951254, 45294845176 (three jobs), 45410377843 (three jobs) and 45412674238, which passed when its failed job was re-run with no change.

The miss has two messages. Nine read Artifact not found for name. Three read No artifacts found for ID, and those follow a lookup by name that worked, as in run 44910286262:

13:43:47.687  Artifact no-wheels-fixture successfully finalized. Artifact ID 14708489740
13:43:48.469  Downloading single artifact
13:43:48.631  - no-wheels-fixture (ID: 14708489740, Size: 155, Expected Digest: sha256:8d1ce5db…)
13:43:48.758  ##[error]Unable to download artifact(s): No artifacts found for ID: 14708489740

Both lookups are the same ListArtifacts call with a different filter (getArtifactInternal and downloadArtifactInternal in @actions/artifact). They ran 0.13 s apart and disagreed. So the listing lags after an upload, whichever filter asks.

The tests passed on main at 12:47 UTC on 21 November and missed at 13:43 UTC. The job that missed first builds nothing: it uploads a fixture with actions/upload-artifact and runs this action with artefact_name set, and both pins date from 15 October. That points at a change on GitHub's side. It is an inference: GitHub's status page lists no incident for it.

Cause

  • action.yaml lines 214–222 hold one actions/download-artifact v8.0.2 step, with no second attempt.
  • That step looks the artefact up by name and then again by ID. Either lookup can miss just after the upload.
  • Test Custom Artefact Name and Test No Wheels Guard pass artefact_name, which skips the naming step, so their download starts a third of a second after the upload. Run Tests 🧪 resolves the name first and starts about two seconds after it. The tests-python-project-type job that Fix: Declare the Python project type #294 adds has the shape of Run Tests 🧪.

Changes

  • Give the download a fixed, documented number of attempts with a short wait between them, for example three attempts with waits of 5 s and 15 s. Fix: Retry the artefact download by name pypi-publish-action#240 proposes five attempts over about thirty seconds for the same fault; use one figure in both actions if that change has merged first.
  • Retry whenever the download step fails. This action cannot tell a miss from another failure: a later step reads only the download step's outcome, and artefact_path may hold files before the download, so an empty directory proves nothing here. A project at the repository root that builds in the same job leaves dist/ behind, and Run Tests 🧪 downloads into the same dist/ three times.
  • The last attempt's failure fails the action, as a failed download does today. No step after the download may run once every attempt has failed, so that wheels already in artefact_path are never audited in place of the artefact.
  • On final failure, name the artefact and say how many attempts were made.
  • Keep the artefact's name, artefact_path, the Check artefact name guard and the pinned actions/download-artifact commit as they are.
  • One way to do this in a composite action is to repeat the download step behind continue-on-error: true and a check on the previous attempt's outcome, with a wait step between attempts. Any approach that meets the criteria below is fine.
  • Describe the retry in README.md, in the paragraph on the artefact download.

Tests

  • Keep the jobs that build and audit in one job as they are, with no sleep and no split. They are the ones that exercise the real lookup, and they are how this change shows on main.
  • Add a pytest module in the style of tests/test_artefact_name_guard.py, which reads the steps out of action.yaml. It should show that each later attempt runs only when the one before failed, that a wait lies between attempts, that the last failure is not swallowed, and that no step after the download can run once every attempt has failed. tests/test_artefact_name_guard.py and tests/test_install_step_guard.py find the download step by its name and expect one such step; bring them along.
  • Add a job to .github/workflows/testing.yaml that runs the action with an artefact_name nothing uploaded, and checks that it failed after the last attempt, in the download and not in a later step. The invalid permit_fail case in Run Tests 🧪 shows one way to tell where an action failed.

A miss followed by a find cannot be staged on demand. The existing jobs supply it: before this change, most runs lose at least one of them.

Acceptance criteria

  • A failed download is retried a fixed, documented number of times, with a wait between attempts
  • When every attempt fails, the action fails with an error naming the artefact and the number of attempts, and no later step runs
  • A download that succeeds at once behaves as before, with no added wait
  • The tests above pass on the pull request, and the existing jobs are unchanged
  • The README documents the retry
  • Repository hooks pass; Zizmor's auditor persona reports no findings in changed workflow or action files

Related

Notes for an automated author

  • The new job lives in a workflow file, so this issue needs a dispatch with allow_workflow_edits=true.
  • uses: $/ is this repository's self-reference and is correct; do not change it to ./.

Activity

  1. added
    bug
    workflow-edits-ok
    on Nov 24, 2026
  2. ModeSevenIndustrialSolutions commented on Nov 24, 2026

    @ModeSevenIndustrialSolutions
    MemberAuthor

    #294 has merged, so this can start. lfreleng-actions/pypi-publish-action#242 has merged too, which settles the figures: use the ones it uses.

    • Five attempts, with waits of 2, 4, 8 and 16 seconds after attempts one to four, thirty seconds in all. That is max_attempts and delays in scripts/retry-download.sh there, and the same chain of download and check steps in its action.yaml is a working model for the step layout.
    • Do not copy its test for a miss. It retries only while its download directory is empty, which works there because that directory is a new, empty staging directory. Here artefact_path may hold files before the download, so retry on any failure of the download step, as the issue says.

    The schedule is enough for the fault as measured. On main of pypi-publish-action, in the first run after that change merged (45431465897):

    15:58:50.851  Artifact lfreleng-test-python-project successfully finalized. Artifact ID 14939118801
    15:58:52.629  Downloading single artifact                      (attempt 1)
    15:58:52.901  ##[error]Unable to download artifact(s): Artifact not found for name: lfreleng-test-python-project
    15:58:52.917  Artefact 'lfreleng-test-python-project' not found on attempt 1 of 5; retrying in 2s
    15:58:55.010  Downloading single artifact                      (attempt 2)
    15:58:55.892  Total of 1 artifact(s) downloaded
    

    The artefact was missing 1.8 s after its upload and listed 4.2 s after it.

    The latest push to main here failed on the same miss in Run Tests 🧪 and Test Custom Artefact Name (run 45425956106), 1.8 s and 0.2 s after their uploads. Those two jobs are the ones to watch on the pull request.

  3. lf-releng-code-monkey-bot commented on Nov 24, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent has proposed a change for this issue: pull request #296 (head 2a2bf68). The Copilot review of it is clean. Checks failed on its head: Test Custom Artefact Name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugworkflow-edits-ok

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions