Skip to content

fix(ci): Cache records its roots without asking R2 to create the bucket - #8573

Merged
kixelated merged 1 commit into
mainfrom
fix/cache-no-check-bucket
Nov 12, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/cache-no-check-bucket

Conversation

@kixelated

@kixelated kixelated commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every Cache push run on main fails, in all four jobs (for example 43271095618), at just infra nix roots:

ERROR : dev-x86_64-linux: Post request rcat error: failed to prepare upload: operation error S3: CreateBucket, https response error StatusCode: 403 ... AccessDenied

rclone's S3 backend sends CreateBucket before its first upload into a bucket unless no_check_bucket is set. The cache-write R2 token may write objects but not create buckets, so the request is refused and rcat fails. nix copy in the preceding push step succeeds, so paths reach nix.moq.dev, but no commit ever gets its roots/<commit>/ record and refresh never restarts the age of reused paths.

The now-deleted Cache refresh workflow failed for the same reason: its last run, 42829996937, ended with no closures recorded for 9492473d5f...; a Cache push run records them. moq-dev/moq#8425 deleted that workflow and fixed the earlier does not contain a 'flake.nix' failure in roots, which is what exposed this one.

Approach

Export RCLONE_CONFIG_R2_NO_CHECK_BUCKET=true on the r2: remote in infra/nix/justfile. Both buckets exist (just infra nix create makes them), so the check only ever adds a denied request.

Impact

  • Public API: none. Wire: none.

Caused by

  • moq-dev/moq#8173 - added the r2: rclone remote and the roots upload without no_check_bucket, so the upload needs bucket-create rights the CI token lacks.

Validation

  • Reproduced against a local fake S3 endpoint that denies bucket-level PUT, as an object-scoped R2 token does, with rclone 1.76.0 from nixpkgs (readlink | rclone rcat r2:nix-ci-moq-dev/roots/abc/dev):
    • before: rclone sent PUT /nix-ci-moq-dev and failed with the same CreateBucket ... 403 ... AccessDenied as CI;
    • with RCLONE_CONFIG_R2_NO_CHECK_BUCKET=true: no bucket request, only PUT /nix-ci-moq-dev/roots/abc/dev?x-id=PutObject.
  • just --justfile infra/nix/justfile --evaluate shows the new export.
  • Not run against the real bucket: the R2 credentials live only in the cache-write Environment. The first Cache run on main after merge is the end-to-end check.
  • just --fmt --check on the changed justfile: clean.

Models

  • Size: XS
  • Implementer: Claude Code, claude-opus-5-5, unknown effort

🤖 Generated with Claude Code

(Written by Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 3507914

  • Base: origin/main at bec81e4

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1d109-5da3-7780-9303-04eea9edf6dd, round 1

  • Score: 10/10, The narrowly scoped remote setting lets rclone upload root records without attempting bucket creation, matching CI credentials and an existing repository pattern without identifiable regressions.

  • Findings: none

Every Cache push run on main fails in `just infra nix roots`: rclone's S3
backend tries CreateBucket before its first upload, and the cache-write R2
token, scoped to objects, gets 403 AccessDenied. Set no_check_bucket on the
`r2:` remote so rclone writes the object directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 12, 2026 18:34

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the single-file diff to infra/nix/justfile.

  • RCLONE_CONFIG_R2_NO_CHECK_BUCKET: exports true on the r2: remote so rclone rcat stops sending CreateBucket. This matches the existing pattern in infra/rpm/publish.sh. Bucket creation goes through wrangler r2 bucket create, not rclone, so the flag doesn't affect create.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The R2 rclone configuration sets RCLONE_CONFIG_R2_NO_CHECK_BUCKET to "true". A comment states that the CI token cannot create buckets and that rclone otherwise tries to create the bucket before uploading.

Merge Risk: Minimal · up to 35079

This change lets Cache push runs record roots without asking R2 to create the bucket. No actionable merge-blocking risk is evident; the first Cache run on main will confirm it end to end.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Cache run now records its roots without asking R2 to create the bucket. The summary confirms the justfile change sets RCLONE_CONFIG_R2_NO_CHECK_BUCKET to true, whi…
Description check Passed The description covers the failure, its cause, the fix, the validation steps, and the related PRs. It matches the changeset, which sets the no_check_bucket option on the r2 rclone remote in infra/nix/…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Cache run now records its roots without asking R2 to create the bucket. The summary confirms the justfile change sets RCLONE_CONFIG_R2_NO_CHECK_BUCKET to true, which matches the title. The title is specific and concise, and it uses the conventional commit prefix.

Full details: Description check

Explanation

The description covers the failure, its cause, the fix, the validation steps, and the related PRs. It matches the changeset, which sets the no_check_bucket option on the r2 rclone remote in infra/nix/justfile.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29b75acc-a62a-4596-8fc4-3400e4c8f7bb
Commits

Reviewing files that changed from the base of the PR and between bec81e4 and 3507914.

Files selected for processing: 1

  • infra/nix/justfile

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@kixelated
kixelated added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 5c8ef1f Nov 12, 2026
9 checks passed
@kixelated
kixelated deleted the fix/cache-no-check-bucket branch November 12, 2026 22:00
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.

1 participant