Skip to content

Await R2 readbacks across public-channel propagation lag - #32

Merged
AlexMikhalev merged 1 commit into
mainfrom
fix/promote-r2-readback-await
Sep 25, 2026
Merged

AlexMikhalev merged 1 commit into
mainfrom
fix/promote-r2-readback-await

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Problem

Promote run 36187580126 (with the S3 transport from #31) aborted on ERROR: uploaded R2 object is absent: terraphim-agent-1.21.16-aarch64-unknown-linux-musl.tar.gz. The aws s3api put-object was acknowledged, the readback two seconds later returned 404, and the object surfaced on downloads.terraphim.ai roughly five minutes after the write. Response headers show cf-cache-status: DYNAMIC, so the 404s were origin responses behind a propagation lag on the public custom domain; this also retroactively explains run 36185425648, whose "vanished" wrangler upload was a readback racing the same lag.

Change

  • scripts/promote-release.sh: post-put readbacks for immutable objects and stable pointers now retry every five seconds for R2_READBACK_WAIT seconds (default 600, validated 0 through 3600) before the run declares the object absent and stops. Preflight/immediate reads keep their single-shot strict semantics, and the byte comparison of every readback is unchanged.
  • tests/test_promotion_contract.py: the curl stub gains LAG_KEY/LAG_READS (origin 404s for the first N reads of a key that exists). One test pins the retried success including the exact read count, and the R2_READBACK_WAIT=0 bounded-timeout failure that must stop before any stable write. All 21 promotion contract tests pass locally.
  • docs/release-operator-checklist.md: documents the lag and the wait knob.

Re-dispatching after merge is safe and idempotent: live objects are preflight-compared and skipped; the two objects already written by run 36187580126 will be found identical.

Refs #337

Promote run 36187580126 aborted because the aws s3api put for
terraphim-agent-1.21.16-aarch64-unknown-linux-musl.tar.gz was acknowledged
but the immediate readback through downloads.terraphim.ai returned 404;
the object surfaced on the public channel roughly five minutes later with
cf-cache-status DYNAMIC, so the 404s were origin responses behind a
propagation lag, not edge-cache staleness or a failed write. Post-put
readbacks now retry every five seconds for R2_READBACK_WAIT seconds
(default 600, 0 through 3600 validated) before declaring an object or
stable pointer absent. The promotion contract gains a lag-simulating curl
stub mode pinning both the retried success and the bounded-timeout
failure that must stop before any stable write. Refs #337
@AlexMikhalev
AlexMikhalev merged commit 9513b03 into main Sep 25, 2026
2 checks passed
@AlexMikhalev
AlexMikhalev deleted the fix/promote-r2-readback-await branch September 25, 2026 20:56
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