Skip to content

fix(release): try an infra image's build, push or tag again while a registry rate-limits it - #272

Merged
earakely-scale merged 1 commit into
mainfrom
ci/infra-image-rate-limits
Oct 20, 2026
Merged

earakely-scale merged 1 commit into
mainfrom
ci/infra-image-rate-limits

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

The first run by hand of the release workflow on main (run 39511020412) failed on both attempts in the same place: a base image's pull, 429 Too Many Requests from public.ecr.aws.

#2 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code
https://public.ecr.aws/v2/docker/library/python/manifests/sha256:c208…: 429 Too Many Requests
  • Why: the ten build jobs (five images × two platforms) started together. Each pulled its base images anonymously, and ECR Public allows one anonymous pull a second. fail-fast then cancelled the rest.
  • Why it matters beyond this run: with publishing on, a failed build also keeps the release off PyPI.

What changes

  • infra_build.py retry COMMAND... runs the command, and again after 30, 60 and 120 seconds while what it printed says a registry rate-limited it: ECR Public's 429, or the toomanyrequests error GHCR and Docker Hub send. Any other failure fails at once.
  • The workflow wraps docker build, docker push and imagetools create in it. The registry lookups behind exists and verify-record retry the same way.
  • The build matrix runs four at a time (max-parallel: 4), so its burst of base-image pulls is smaller.

The script still uses only the standard library and the docker CLI.

How it was tested

  • New unit tests cover a command that works first time, one rate-limited twice then working, one that gives up after the three waits, a failure of another kind (not retried), a rate-limited registry lookup, and the workflow wiring. The unit tier passed (8,799).
  • retry passes a whole command line, flags included, through to the command.

The real check is the next run by hand on main.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking improvement needed to show command output promptly.

Fix All in CursorFindings

  1. P2 Progress messages arrive late ▶
Fix with agent prompt
### Issue 1
.github/scripts/infra_build.py:116
`_streamed` writes each line without flushing it. In the release workflow, Python's output goes to a pipe, so short messages stay buffered until enough output arrives or the helper exits. The retry warning can also remain hidden during the waits, making the job look stuck. Flush after forwarding each line and printing the warning, or run the helper with unbuffered output.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds bounded retries for registry rate limits during image builds, pushes, tagging, and lookups.

  • Infra image publishing retries when registries apply rate limits.
  • Image builds run no more than four jobs at once.

One non-blocking issue remains: forwarded output and retry warnings can stay buffered.

Reviews (1) · Last reviewed commit: "fix(release): try an infra image's build..." · Reviewed by Greptile

…egistry rate-limits it

The first run by hand failed twice on a base image's pull: the ten builds
started together, and public.ecr.aws answered 429 Too Many Requests, since it
allows one anonymous pull a second. A failed build would also keep a release
off PyPI.

infra_build.py retry runs a command, and again after 30, 60 and 120 seconds
while what it printed says a registry rate-limited it (ECR Public's 429, or the
toomanyrequests error GHCR and Docker Hub send); any other failure fails at
once. The workflow wraps docker build, docker push and imagetools create in it,
the registry lookups behind exists and verify-record retry the same way, and the
build matrix runs four at a time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner October 20, 2026 23:30
process = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
printed = []
for line in process.stdout:
sys.stdout.write(line)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Progress messages arrive late

_streamed writes each line without flushing it. In the release workflow, Python's output goes to a pipe, so short messages stay buffered until enough output arrives or the helper exits. The retry warning can also remain hidden during the waits, making the job look stuck. Flush after forwarding each line and printing the warning, or run the helper with unbuffered output.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/scripts/infra_build.py
Line: 116

Comment:
**Progress messages arrive late**

`_streamed` writes each line without flushing it. In the release workflow, Python's output goes to a pipe, so short messages stay buffered until enough output arrives or the helper exits. The retry warning can also remain hidden during the waits, making the job look stuck. Flush after forwarding each line and printing the warning, or run the helper with unbuffered output.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Valid: fixed in #273, since this one had merged. _streamed flushes after each line it forwards, and the retry warning is printed with flush=True.

@earakely-scale
earakely-scale merged commit dca1068 into main Oct 20, 2026
14 checks passed
@earakely-scale
earakely-scale deleted the ci/infra-image-rate-limits branch October 20, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant