Skip to content

fix(cache): stop reporting failed reservations as a benign race - #663

Merged
zackees merged 1 commit into
mainfrom
fix/662-reservation-failure-status
Nov 7, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/662-reservation-failure-status

Conversation

@zackees

@zackees zackees commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #662.

Problem

A failed cache reservation (5xx, 429, expired token, missing signedUploadUrl) produced the same status as a real conflict, so cook-cache logged save status=skipped-race-precheck error=none for a layer that was never written.

Change

  • reserve() returns {kind:"reserved",reservation} | {kind:"conflict"} | {kind:"failed",message} on both the v2 and v1 paths.
  • TwoPhaseCacheResult gains reservation-failed with an error. skipped-reservation now only means a real conflict.
  • Both cook-cache.ts call sites map reservation-failed to {status:"failed", error}. post.ts already renders that status.
  • The failure is logged with its status, and URLs and bearer tokens are redacted from both the log line and the returned error.
  • cook-post.ts now prints error= on its save status= lines. Without this the standalone cook action would show failed with no reason.

How conflicts are detected

CreateCacheEntryResponse only has ok, signedUploadUrl and message. The v2 client throws on any non-2xx, with the status only in the text: Failed to CreateCacheEntry: ... Failed request: (409) Conflict: <msg>. Classification therefore runs on the thrown message as well as the response, and a status in the text decides on its own. Checking only the response would have reported every ordinary race as a failure.

v1 uses response.statusCode === 409 directly.

Behaviour changes to review

  • cook/action.yml with fail-on-error: true now fails the job on a reservation failure. Previously this was a silent skip. This matches that input's description, and the default is false.
  • ok:false with no "already exists" text is now failed. Upstream @actions/cache treats it as a possible race, so this errs towards reporting.

Bundles

dist/main.js, dist/post.js and cook/dist/* are rebuilt. Most of the large line count is ncc renumbering its module IDs, so review src/ rather than the bundle diff.

Verification

npm ci, then npm run lint, npm run typecheck, npm run build and npm test: all exit 0 (1071 tests: 1070 pass, 0 fail, 1 skipped; pretest 12/12). The tests send 409, 500, 429, 401 and 403 through the real twirp client against a local HTTP server. They have not run against the live GitHub cache service.

🤖 Generated with Claude Code

A failed cache reservation returned the same status as a real conflict,
so cook-cache logged "skipped-race-precheck error=none" for a layer that
was never written, hiding 5xx, 429 and auth failures.

reserve() now returns reserved | conflict | failed, and TwoPhaseCacheResult
gains "reservation-failed", which cook-cache maps to status=failed.

The v2 twirp client throws on non-2xx and exposes no status on its response,
so a real 409 is recognized from the thrown "Failed request: (409)" text.
Errors are redacted before logging. cook-post now prints error= as well.

Fixes #662

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit d01d9ba Nov 7, 2026
43 checks passed
zackees added a commit to obs-rust/obs-studio that referenced this pull request Nov 7, 2026
…p backoff)

Consumers pin zackees/setup-soldr by SHA, so the two merged fixes in #661 and #663 are inert here until the pin moves. Both are fixes, neither changes inputs:

- forge-ci/setup-soldr#663: a failed cache reservation is no longer reported as a successful race. The Linux cook-cache layer has never existed in this repository while every run logged 'save status=skipped-race-precheck error=none'; after this, a reservation that fails reports 'save status=failed error=<status>' instead of the benign sentence. That is what makes the missing Linux layer diagnosable at all.
- forge-ci/setup-soldr#661: bootstrap backs off transient release download retries instead of failing the job.

12 pins updated across build-project.yaml and release-rust.yaml, plus the SETUP_SOLDR_PIN constant in ci/test_ci_toml.py that asserts they all agree (47 tests pass). SETUP_SOLDR_COOK_PREFIX stays cook-base-v3: COOK_BASE_KEY_PREFIX is unchanged at the new SHA, so the deps cache family is unaffected.

Compare c6f5541a...d01d9bae: 4 commits, 14 files, all fixes.
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Nov 7, 2026
…p backoff) (obs-rust#3790)

Consumers pin zackees/setup-soldr by SHA, so the two merged fixes in obs-rust#661 and obs-rust#663 are inert here until the pin moves. Both are fixes, neither changes inputs:

- forge-ci/setup-soldr#663: a failed cache reservation is no longer reported as a successful race. The Linux cook-cache layer has never existed in this repository while every run logged 'save status=skipped-race-precheck error=none'; after this, a reservation that fails reports 'save status=failed error=<status>' instead of the benign sentence. That is what makes the missing Linux layer diagnosable at all.
- forge-ci/setup-soldr#661: bootstrap backs off transient release download retries instead of failing the job.

12 pins updated across build-project.yaml and release-rust.yaml, plus the SETUP_SOLDR_PIN constant in ci/test_ci_toml.py that asserts they all agree (47 tests pass). SETUP_SOLDR_COOK_PREFIX stays cook-base-v3: COOK_BASE_KEY_PREFIX is unchanged at the new SHA, so the deps cache family is unaffected.

Compare c6f5541a...d01d9bae: 4 commits, 14 files, all fixes.
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.

cache save: a failed reservation is reported as 'skipped-race-precheck', so a layer that was never written looks like a benign race

1 participant