Skip to content

fix: retry artifact discovery after upload - #455

Open
neilime wants to merge 1 commit into
actions:mainfrom
neilime:fix/retry-pages-artifact-discovery
Open

neilime wants to merge 1 commit into
actions:mainfrom
neilime:fix/retry-pages-artifact-discovery

Conversation

@neilime

@neilime neilime commented Nov 12, 2026

Copy link
Copy Markdown

A successfully finalized Pages upload can briefly be absent from the artifact service listing. When upload and deployment run in the same job, getArtifactMetadata fails immediately even though the artifact becomes visible shortly afterward.

Retry the metadata lookup only when no artifact matches the requested name: five attempts with 1, 2, 4 and 8 second delays. Available artifacts return immediately. Duplicate matches and artifact service errors keep their existing failure behavior. Deployment creation is not retried, and no new inputs are introduced.

Closes #451.

Validation:

  • Reproduced the missing-artifact failure with a deterministic regression test before the fix.
  • npm run all passes on Node.js 24.22.1: formatting, ESLint, ncc build, all 37 tests and coverage badge generation.
  • Tests cover immediate visibility, delayed visibility alongside unrelated artifacts, exhausted retries, duplicate matches and service errors. The deployment integration test exercises a missing-then-visible artifact before one successful deployment request.
  • Committed the regenerated distribution and coverage badge.

Observed consumer failure: https://github.com/escemi-tech/escemi-website/actions/runs/43214954672/attempts/1. The unchanged consumer succeeded when its failed deployment job was rerun.

@neilime
neilime requested a review from a team as a code owner November 12, 2026 12:52
Copilot AI balanced review requested due to automatic review settings November 12, 2026 12:52

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.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

A test reliability issue remains because the Jest mock for node:timers/promises is declared after the relevant require calls in src/__tests__/internal/api-client.test.js, risking use of the real timer implementation and causing slow or flaky tests until the mock is moved earlier.

1 open issue
What changed in this PR

Adds bounded retry/backoff to artifact metadata discovery to mitigate eventual-consistency gaps when Pages upload and deployment run in the same job.

Changes:

  • Retry artifact listing only for the “no match found” case (bounded attempts with backoff) while preserving existing failures for duplicates and service errors.
  • Expand unit and integration tests to cover immediate visibility, delayed visibility, exhausted retries, duplicates, and service errors.
  • Regenerate the bundled distribution output and update the coverage badge.
File Description
src/​internal/​api-client.js Introduces a bounded retry/backoff wrapper for listing artifacts and uses it in getArtifactMetadata to tolerate brief post-upload visibility delays.
src/​__tests__/​internal/​deployment.test.js Updates deployment integration tests to simulate a missing-then-visible artifact and validate the new retry behavior during deployment flow.
src/​__tests__/​internal/​api-client.test.js Adds focused unit tests covering retry behavior when no artifact matches and ensuring duplicates and service errors retain existing failure paths.
dist/​index.js Regenerates the compiled/bundled distribution to include the updated artifact discovery retry logic.
coverage_badge.svg Updates the coverage badge to reflect the latest test run after adding retry-related test cases.

Review effort: Balanced

@neilime
neilime force-pushed the fix/retry-pages-artifact-discovery branch from 96efc9a to eb6bb52 Compare November 12, 2026 12:58
@windrover

Copy link
Copy Markdown

Data point on the retry budget, from a minimal public reproducer: https://github.com/windrover/artifact-visibility-probe

Same shape as the production layout (actions/upload-pages-artifact@v5 immediately followed by actions/deploy-pages@v5, ~1.9 MB artifact), 8 runs. The first lookup missed in 4/8 runs, and the time from artifact finalize to the first successful listing was 0.44 / 0.46 / 0.46 / 0.71 / 2.09 / 2.10 / 2.17 / 5.75 s (median ~1.4 s). So 1, 2, 4, 8 seconds (~15 s total) would have covered everything the probe saw.

One caveat about the tail: in our production repo the same layout once needed ~46 s (finalize 03:12:07.428Z, first successful lookup 03:12:53.368Z, run https://github.com/windrover/dsh-table-sync/actions/runs/45537648379), even though the artifact was already listed through the REST API. If the budget is meant to absorb the tail rather than the median, a longer capped sequence (1/2/4/8/16/32/64 s, ~127 s) or a configurable total budget would be safer.

@ViliusS

ViliusS commented Nov 25, 2026 •

Copy link
Copy Markdown

The fact that this is an issue and we have to implement such workarounds is exactly why I don't trust GitHub anymore. This should be fixed at infrastructure level, i.e. upload endpoint should not return true until the artifact is fully visible, or download should query origin if this issue is related to some kind of caching.

Can someone at GitHub have this merged? Or better yet, solve this at infrastructure level? It is unacceptable that such issues sit in the pipeline for months.

ek33450505 added a commit to ek33450505/Edward_Kubiak that referenced this pull request Nov 25, 2026
)

* Move the workflows' GitHub actions to their Node 24 majors

Every deploy and CI run warned that its actions target the
deprecated Node 20 runtime. Bump checkout and setup-node to v7,
configure-pages to v6, upload-pages-artifact to v5, deploy-pages to
v5 (all three attempts) and upload-artifact to v7, in deploy.yml,
ci.yml and cast-stats-check.yml.

upload-pages-artifact v4+ leaves dotfiles out of the artifact; the
build emits none. weekly-refresh.yml is SHA-pinned and gates pushes
to main, so it is left for a separate change.

Co-Authored-By: Rocky, Ed's AI pair programmer (Claude Opus 5.5) <[email protected]>

* Note when to remove the deploy-pages retry

Issues are disabled on this repo, so CLAUDE.md is where the retry
from #79 records its exit condition: actions/deploy-pages#455 merged
and released, and no more "Deploy retry" warnings.

Co-Authored-By: Rocky, Ed's AI pair programmer (Claude Opus 5.5) <[email protected]>

---------

Co-authored-by: Rocky, Ed's AI pair programmer (Claude Opus 5.5) <[email protected]>
radubahmata added a commit to radubahmata/blog that referenced this pull request Nov 25, 2026
- deploy-pages@v4 resolves the github-pages artifact by name once, right
  after upload. Since 2026-11-24 the artifact service often lists it
  seconds later, failing the daily deploy (actions/deploy-pages#451).
- Retry only the deploy step after 5s, 20s and 60s; re-uploading would
  produce duplicate artifacts. Remove once actions/deploy-pages#455 ships.
jmoo added a commit to jmoo/drawbar that referenced this pull request Nov 26, 2026
…369)

The `pages` job on `master` failed on both attempts of [run
45320732077](https://github.com/jmoo/drawbar/actions/runs/45320732077).
The site built and `upload-pages-artifact` finalized the `github-pages`
artifact; `deploy-pages`, the next step, looked it up 0.4 s later, found
none, and failed:

```
Artifact github-pages.zip successfully finalized. Artifact ID 15071224386
Fetching artifact metadata for "github-pages" in this workflow run
Found 0 artifact(s)
Error: No artifacts named "github-pages" were found for this workflow run.
```

Nothing in the repository changed between the last deploy that passed
and this one: same workflow file, same action commits. This is
actions/deploy-pages#451. Reports there measure the artifact missing
from the list for anything from under a second to about 46 s after the
upload, and note that the action reads a different listing from the REST
API, so polling the API before deploying proves nothing.

## The change

- The first `deploy-pages` step may fail without failing the job.
- When it fails, the job sleeps 60 s and deploys once more. That step is
not allowed to fail, so a deploy that fails twice still turns the job
red.
- The environment URL comes from whichever step deployed.

An immediate retry was reported to read the same stale list, hence the
wait. One retry after a wait longer than the longest reported lag keeps
this to two extra steps. The retry costs nothing when the first deploy
works.

Splitting upload and deploy into two jobs was the alternative. It only
adds the few seconds a job takes to start, which the reported lag
exceeds.

## Checks

- `actionlint` passes on the workflow; `nix fmt` changes nothing.
- The `pages` job runs only on `master`, so the retry itself is
unverified until this merges.

The retry can go once a `deploy-pages` release retries the lookup itself
(actions/deploy-pages#455 is open).

Release-note: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.2 <[email protected]>
LateGenXer added a commit to LateGenXer/finance that referenced this pull request Nov 26, 2026
actions/deploy-pages looks up the uploaded artifact by name in the
artifact service, whose listing can lag behind the upload, failing with
'No artifacts named "github-pages" were found'.  Re-running the job does
not help either, as it uploads a second artifact and then fails with
'Multiple artifacts named "github-pages"'.  So retry only the deployment
step, with growing delays.

See also:
- actions/deploy-pages#451
- actions/deploy-pages#455
- https://www.jvt.me/posts/2026/11/25/github-pages-artifacts-bug/

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SUPUZZ pushed a commit to SUPUZZ/supuzz.github.io that referenced this pull request Nov 27, 2026
GitHub 工件服务在 upload 完成后有秒级到分钟级的索引延迟,
deploy-pages 只查一次列表,查早了就报 No artifacts named github-pages
(actions/deploy-pages#451,2026-11 起明显恶化,v5 同样中招)。

- 部署失败后按 5s/20s/60s 重试 deploy-pages,共 4 次机会
- 只重试部署、不重试上传:同一 run 再传一次会变成
  Multiple artifacts named "github-pages",那条 run 就彻底救不回来
- 用 continue-on-error + 末尾兜底步骤决定 job 红绿,避免误报成功
- 上游修复 actions/deploy-pages#455 发布后可精简掉这些重试
Mpdreamz added a commit to elastic/docs-builder that referenced this pull request Nov 27, 2026
* Retry the Pages deploy when the artifact is not found yet

actions/deploy-pages can look for the artifact before it is visible and fail with "No artifacts named github-pages were found" (actions/deploy-pages#451). Re-running the job then fails on duplicate artifacts. The deploy step now retries up to three times after 5, 20 and 60 seconds, and the page URL output falls back across the attempts. Remove the retries once actions/deploy-pages#455 is released.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Retry the Pages deploy only after a fast failure

A missing artifact fails within a second. A deploy that ran for 30 seconds or more, such as a Pages status timeout, is not a lookup miss, and retrying it could hold the deploy concurrency slot for four attempts. Each retry now waits behind a gate that fails the job when the previous attempt ran that long.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Allow two minutes before a failed Pages deploy stops retrying

The gate infers the cause from elapsed time, because deploy-pages sets no output on failure. A 30 second cutoff could treat a fast lookup miss as slow after a runner pause. Two minutes sits far above a lookup miss and far below the 10 minute deploy timeout.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>

This branch has not been deployed

No deployments
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.

Intermittent "No artifacts named github-pages" when deploy-pages runs right after upload-pages-artifact in the same job

5 participants