Skip to content

Fix: Retry the artefact download - #296

Merged
ModeSevenIndustrialSolutions merged 3 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-295
Nov 24, 2026
Merged

ModeSevenIndustrialSolutions merged 3 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-295

Conversation

@lf-releng-code-monkey-bot

Copy link
Copy Markdown
Contributor

Closes #295

Authored by an AI agent; human review required
Command Exit
uv run --locked python -m pytest tests -q (at test commit, 3 xfailed) 0
prek run --files tests/test_download_retry.py tests/test_artefact_name_guard.py tests/test_dependency_cache.py 0
prek run --files action.yaml README.md tests/test_download_retry.py 1
prek run --files action.yaml README.md tests/test_download_retry.py 0
prek run --files .github/workflows/testing.yaml 0
uv run --locked python -m pytest tests -q 0
uvx zizmor --persona=auditor --offline .github/workflows/testing.yaml action.yaml 0
AISLOP_NO_TELEMETRY=1 prek run --files .github/workflows/testing.yaml README.md action.yaml tests/test_artefact_name_guard.py tests/test_dependency_cache.py tests/test_download_retry.py 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.


GitHub's artefact service can fail to list an artefact for a second or two after its upload, so the action's single actions/download-artifact step missed whenever it followed an upload in the same job, although the artefact existed.

What changed

  • action.yaml: the download is now a chain of five attempts (download_1…download_5), with wait steps of 2, 4, 8 and 16 seconds between them, thirty seconds in all. These are the figures Fix: Retry the artefact download by name pypi-publish-action#242 uses, as the issue comment asks. Each later attempt, and each wait, runs only when steps.download_<n-1>.outcome == 'failure', so a download that succeeds at once runs exactly as before and adds no wait. Every failure is retried, since artefact_path may already hold files and a miss cannot be told from another failure. Attempts 1–4 carry continue-on-error: true. The last attempt does not, so its failure fails the action and every later step, which runs on the implicit success(), is skipped. A Report artefact download failure step (failure() && steps.download_5.outcome == 'failure') then logs ::error::Artefact <name> not downloaded after 5 attempts and exits 1. The artefact name expression, artefact_path, the Check artefact name guard and the pinned download-artifact commit are unchanged.
  • README.md: the artefact name section now describes the retry.
  • Tests: a new tests/test_download_retry.py reads the chain out of action.yaml. It checks the attempt count, the gating on the previous attempt's outcome, that the waits sit between attempts, and that only the last attempt lacks continue-on-error. It runs the wait and report scripts against a stub sleep, and checks that no step after the download uses a status function. These tests landed first, marked strict xfail. tests/test_artefact_name_guard.py and tests/test_dependency_cache.py now find the download attempts by their pinned uses: instead of by one step name.
  • .github/workflows/testing.yaml: one new job runs the action with an artefact_name that nothing uploaded. It checks that the action failed, that at least 30 s passed (so it stopped only after the last attempt), and that no later step ran: pythonLocation is unchanged (setup-python did not run), the install venv does not exist and audit_outcome is skipped. A second new job runs the new pytest module. The existing jobs that build and audit in one job are unchanged.

Checks run

  • uv run --locked python -m pytest tests -q: 67 passed. At the test commit: 64 passed, 3 xfailed.
  • prek run --files <all changed files>: every hook passed, aislop included, with AISLOP_NO_TELEMETRY=1.
  • zizmor --persona=auditor --offline action.yaml .github/workflows/testing.yaml (v1.33.1): no findings.

For reviewers

  • When the artefact is missing at first and found on a retry, the job still passes, but the log keeps download-artifact's Unable to download artifact(s) error annotation from each missed attempt, because continue-on-error does not suppress annotations.
  • The report step relies on failure() inside a composite action. If that check ever evaluated false, the action would still fail, because the last attempt has no continue-on-error. Only the summary error line would be lost.
  • The new failure job takes about 30 s longer by design.
  • The retry cannot be staged on demand. Run Tests 🧪 and Test Custom Artefact Name are the jobs that show it on this PR.

lf-releng-code-monkey-bot Bot and others added 3 commits November 24, 2026 16:14
GitHub's artefact service can fail to list an artefact for a few
seconds after its upload, so the action's single download step misses
when it runs in the job that uploaded the artefact.

Add tests reading the download chain out of action.yaml: five
attempts, each later one gated on the failure of the one before, a
wait of 2, 4, 8 and 16 seconds between them, a last attempt that
fails the action, and a report naming the artefact and the attempt
count. The tests that need the retry are marked strict xfail.

The artefact name guard and dependency cache tests now find the
download attempts by their pinned action rather than by one step
name, so they hold for one attempt or several.

Issue lfreleng-actions#295

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
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 failed although the artefact existed.

Repeat the download step: five attempts, with waits of 2, 4, 8 and
16 seconds between them, the figures pypi-publish-action uses for the
same fault. Each attempt after the first, and each wait, runs only
when the attempt before it failed, so a download that succeeds at
once behaves as before. Any failure is retried, since artefact_path
may hold files before the download and a miss cannot be told from
another failure here.

Only the last attempt lacks continue-on-error, so its failure fails
the action and every later step is skipped; wheels already in
artefact_path are never audited in place of the artefact. A report
step then names the artefact and the number of attempts.

Issue lfreleng-actions#295

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add two jobs. One runs the action with an artefact_name nothing
uploaded and checks that it failed only after the 30 seconds of waits
between its five download attempts, and that setup-python, the
install step and the audit did not run after the failed download.
The other runs tests/test_download_retry.py.

The jobs that build or upload and then audit in one job stay as they
are: they exercise the real lookup lag the retry exists for.

Issue lfreleng-actions#295

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change addressing transient artefact-download failures with bounded retries.

No open issues 🎉

What changed in this PR

Adds bounded retries to the Python audit action’s artefact download, addressing temporary lookup failures when an upload and download occur in the same job.

Changes:

  • Adds up to five download attempts with 2, 4, 8 and 16-second waits, preserving the existing artefact inputs and action pin.
  • Reports exhausted retries and prevents downstream setup, installation and auditing after final failure.
  • Documents the retry policy and adds regression and workflow coverage.
File Description
tests/​test_download_retry.py Adds checks for retry conditions, delays, failure reporting and downstream gating.
tests/​test_dependency_cache.py Checks that every download attempt precedes cache-key computation.
tests/​test_artefact_name_guard.py Extends name and guard checks to all download attempts.
README.md Documents retry timing and final-failure behavior.
action.yaml Implements five download attempts, waits and final-failure reporting.
.github/​workflows/​testing.yaml Adds exhausted-retry integration coverage and a retry unit-test job.

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.

The retry chain appears sound: retries stop after success, and exhausting all five attempts fails the action before installation or auditing. No actionable defects found in the diff or dependent code.

Antagonistic round 1 of 3.


Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 8d65799 into lfreleng-actions:main Nov 24, 2026
34 of 35 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-295 branch November 24, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Retry the artefact download

2 participants