Skip to content

Write the Docker Pull Retry Once With One Backoff Schedule - #4503

Merged
ptr727 merged 3 commits into
developfrom
feature/one-docker-pull-retry
Nov 26, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/one-docker-pull-retry

Conversation

@ptr727

@ptr727 ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Summary

The Docker image pull retry was written five times, with three different backoff schedules: 5s/10s, 10s/20s and 15s/30s. This change keeps one implementation and one schedule.

  • One loop. scripts/docker_lint.py's pull_image is now the only retry. It makes 3 attempts and waits 15s, then 30s. A timeout or a client that cannot start is not retried. The client's error output is captured into the failure, so whoever reports it names the cause.
  • Why 15s then 30s. This was the widest of the three existing schedules. validate-task.yml Lint Steps Fail a Release on a Transient Docker Hub Error #1727's failure was a connection reset on Docker Hub's token endpoint during a release run. That blip clears within such a window, and a pull that succeeds never waits.
  • --pull IMAGE mode. It pulls each named image and lints nothing. It cannot be combined with --linter. Under GitHub Actions a retried pull prints a ::warning:: annotation and a failed one an ::error::, as the removed shell loops did. Both are built from the image reference alone.
  • Workflow steps. validate-task.yml's EditorConfig, shell, and PowerShell steps drop their three copied pull() functions and call python3 "$DOCKER_LINT" --pull .... The steps keep their existing pull conditions. EditorConfig checks the whole tree and always pulls, as before. The shell step pulls inside its existing if [ "${#scripts[@]}" -gt 0 ], and the PowerShell step inside its if [ "${#ps_scripts[@]}" -gt 0 ]. No workflow step is declined.
  • Repo gate. repo_gate.py loads the hub's scripts/docker_lint.py the same way it already loads scripts/carry.py. It now does this through one hub_script loader, which registers the module in sys.modules so that docker_lint.py's dataclass resolves. Its shellcheck pull goes through pull_image.
  • Why the loop lives in docker_lint.py rather than in a new module. Fleet repos fetch docker_lint.py through their carried hub_fetch_run.py with only its pin Dockerfile beside it. A new module it imported would break every fleet repo whose hub_fetch_run.py predates it.

Same-ref guarantee for pinned callers

Callers run validate-task.yml at their own hub pin. The --pull mode and the path the steps run always come from that same commit:

  • The steps reach the script only through the new docker-lint output of $/.github/actions/docker-lint-pins. A $/ action runs from the whole hub tree at the calling workflow's own ref. The new Locate Docker lint script step resolves $GITHUB_ACTION_PATH/../../../scripts/docker_lint.py inside that tree. If the file were missing, python3 would fail the step on it.
  • A caller pinned before this change runs the old workflow, which carries its own pull() and reads no docker-lint output.
  • A caller pinned at or after this change gets the workflow and docker_lint.py from one commit, and that commit has --pull.

No ref is ever mixed. The lint steps run the script under the runner's system python3. A new test runs --pull under Python 3.12.

Tests

  • test_docker_lint.py:
    • The schedule is now 15/30, and pulls are --quiet.
    • The failure carries the client's stderr.
    • New tests cover pull(), main --pull routing and its refusal beside --linter, the Actions annotations, and --pull under Python 3.12.
  • test_repo_gate.py:
    • The gate pulls on docker_lint's schedule.
    • A pull that times out is not retried.
    • A docker_lint.py that fails to load becomes the reason.
  • test_release_guards.py:
    • The new locate step names scripts/docker_lint.py in the hub tree.
    • The EditorConfig step pulls through $DOCKER_LINT before docker run, and a failed pull stops it before any container starts.
    • Every docker run in the workflow is preceded by a --pull of its image, and no docker pull is left in the workflow.

Local runs:

  • The full unittest suite, plus ruff, mypy, build_dist.py --check, spec/validate.py and the repo gate.
  • The prose gates, whole-tree and diff.
  • docker_lint.py over the tree: 7 linters, success.
  • A live --pull of the pinned shfmt image, and one of an unresolvable image. The second retried 3 times and failed with the daemon's error.

Closes on promotion: #4499

🤖 Generated with Claude Code

ptr727 and others added 2 commits November 26, 2026 09:40
docker_lint.py's pull_image is now the only Docker pull retry: 3 attempts,
waiting 15s then 30s, a timeout or an unstartable client not retried, and
the client's error output carried into the failure. A new --pull mode pulls
named images and lints nothing.

validate-task.yml's EditorConfig, shell, and PowerShell steps drop their
copied pull() loops and call that --pull mode, still only where the step has
targets. The docker-lint-pins action gains a docker-lint output naming the
script in the hub tree it runs from, so the steps and the script always come
from the workflow's own ref. The repo gate loads the hub's docker_lint.py the
way it loads carry.py and pulls the shellcheck image through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The --pull mode now prints a warning annotation for each retried pull and an
error annotation for a failed one under GitHub Actions, as the removed shell
loops did. The docker-lint-pins locate step loses its file guard, since
python3 already fails loudly on a missing script, and hub_script loses a
rollback nothing reads. The README no longer says the EditorConfig step
skips its pull.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 26, 2026 17:56
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 1d6ae45db0618045961fc26971dfac54daa6cc63, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cf4e380 and 4f4203a.

Files selected for processing: 8

  • .github/actions/docker-lint-pins/action.yml
  • .github/actions/repo-gate/repo_gate.py
  • .github/workflows/validate-task.yml
  • scripts/README.md
  • scripts/docker_lint.py
  • tests/test_docker_lint.py
  • tests/test_release_guards.py
  • tests/test_repo_gate.py
  • 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

Copilot AI 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.

🟡 Changes recommended

A critical active finding remains in scripts/docker_lint.py because unescaped external stderr could inject GitHub Actions workflow commands, so changes are required.

1 open issue
What changed in this PR

This PR centralizes Docker image pull retries in scripts/docker_lint.py, then routes workflow lint steps and the repository gate through that shared implementation.

Changes:

  • Adds --pull IMAGE mode with three attempts and 15-second, then 30-second backoffs.
  • Replaces duplicated workflow and repository-gate pull loops with the shared helper.
  • Expands tests and documentation for retry behavior, annotations, script loading, workflow routing, and pinned script resolution.
File Description
tests/​test_repo_gate.py Tests shared retry behavior, timeout handling, and hub-script loading failures in the repository gate.
tests/​test_release_guards.py Verifies workflow pull routing, same-ref script resolution, pull ordering, and removal of duplicated pulls.
tests/​test_docker_lint.py Covers retry schedules, pull mode, annotations, failure handling, and Python 3.12 execution.
scripts/​README.md Documents the shared pull interface and retry behavior.
scripts/​docker_lint.py Implements the shared pull retry, diagnostics, annotations, and --pull mode.
.github/​workflows/​validate-task.yml Routes EditorConfig, shell, and PowerShell image pulls through the shared script.
.github/​actions/​repo-gate/​repo_gate.py Loads the hub script and reuses its shared pull implementation for shellcheck.
.github/​actions/​docker-lint-pins/​action.yml Exposes the Docker lint script path from the action's pinned hub tree.

Review effort: Lite

Comment thread scripts/docker_lint.py Resolved
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.29%. Comparing base (c25ec49) to head (4f4203a).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4503      +/-   ##
===========================================
+ Coverage    79.00%   79.29%   +0.29%     
===========================================
  Files           50       50              
  Lines        16796    16819      +23     
===========================================
+ Hits         13270    13337      +67     
+ Misses        3526     3482      -44     
Flag Coverage Δ
python-3.13 79.29% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A captured docker pull error now joins its failure on one line, so a
registry's error text never starts a line Actions reads as a workflow
command. The repo gate tests' docker probe runs once, with its pull trace
and annotations off the log, and the locate step's test runs only on POSIX,
where the step itself runs, since Git Bash's pwd prints an MSYS path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 4f4203ac41f5d244652622b4a3a1cd89c67842ff, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit f93f34a into develop Nov 26, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/one-docker-pull-retry branch November 26, 2026 18:40
ptr727 added a commit that referenced this pull request Nov 26, 2026
…s, Environment Secret Audit, and macOS Bash Floor (#4485)

Promotes the 26 pull requests that landed on develop since the last
promotion (#4428), from the away-mode backlog burndown run.

- #4447: Bump markdownlint-cli2-action from 25.0.0 to 25.1.0.
- #4449: Have the agent open and drive the promotion after an audit's
file fix merges.
- #4453: Pass over a signal handled as the prose gate's first handler
starts.
- #4456: Record a managed copy for claude and codex in install-agents
and report any other copy as a stray.
- #4457: Name the PowerShell suppression form and correct the Python CI
backstop text.
- #4458: Read the metrics report's reviewed heads from the gate's one
filter (part of #3880, completed by #4481).
- #4460: Cross-check Python directories against Dependabot's pip and uv
entries (items 2 and 3 of #2286, which stays open for item 1).
- #4461: Pin the Docker lint images by digest through a
Dependabot-tracked manifest.
- #4464: State the platform weighting and correct the hook-promotion
worked example.
- #4463: Key Qodo findings without links or commit hashes and ask
dismissal by title and location.
- #4465: Hand a caller's hook-input to the validate and resolve-upstream
hooks.
- #4466: Require an empty workflow-level permissions block on
entry-point callers.
- #4467: Remove the npm and bun upgrade paths no managed tool reaches.
- #4469: Add a hub-hosted script that enables a clone's hook framework
once.
- #4472: Select each repository's Python line from its root
`.python-version` (the part of #4187 needing no decision; #4187 stays
open).
- #4479: Report dotnet and powershell as unmanaged while Microsoft's
feed is unconfigured.
- #4477: Bound the shell trap's child wait and give the heading search a
file.
- #4480: Check deployment environment secret and variable names in the
audit.
- #4478: Add a macOS bash 4.4 floor with a platform-scoped host tool
entry.
- #4481: Build the gate's comment readers on one trusted-comment reader.
- #4484: Record the measured absence of a git floor for
`--end-of-options`.
- #4496: Narrow the Qodo acknowledgment key's normalization to a link
and a hash after `commit`.
- #4500: Pass over a signal handled as the hook enabler's first handler
starts.
- #4502: Pin the GitHub host for every `gh` child the hub's Python
scripts start.
- #4503: Write the Docker pull retry once, with one backoff schedule.
- #4505: Pin the repo gate's `gh` read and parse the Docker pin manifest
once.

## Release notes for callers

- #4472: A caller passing no `python-versions` input and carrying no
root `.python-version` moves from Python 3.13 to 3.14 for its
`unit-test` leg and its `lint` job's Python steps once its hub pin
reaches this change. Its nested check name moves from `Unit test job
(Python 3.13)` to `Unit test job (Python 3.14)`, and its Codecov flag
from `python-3.13` to `python-3.14`, so a `.codecov.yml` naming the old
flag stops matching. Its `lint` job warns on each run until it carries a
selector. A caller whose `requires-python` or locked dependencies
exclude 3.14 adds a `.python-version` before moving its pin. A
`.python-version` naming no `X.Y` line, or an explicit `python-versions`
whose first entry differs from the file's line, now fails validate.
- #4479: The Linux `install-tools.sh --json` report schema moves from 1
to 2, because a not-installed `dotnet` or `powershell` can now read
`unmanaged` with `installed: null`. A hand-installed amd64 `powershell`
with no Microsoft feed now reads `unmanaged`. The Windows `-Json` report
stays at schema 1.
- #4466: Each entry-point caller must declare an empty workflow-level
`permissions: {}` block. A site repository's `deploy-site.yml` carrying
only job-level blocks now reports this as drift, and the fix belongs to
that repository.
- #4461: Dependabot's docker ecosystem listing tags on mirror.gcr.io for
the shellcheck and shfmt lines is unconfirmed until its first docker run
for that directory.
- #4478: macOS now has a bash 4.4 floor, met by Homebrew's bash ahead of
the system bash on `PATH`. Not yet verified on a native macOS host.
- #4480: The audit gains the `secrets.environments` check. Registry
`environments[]` entries may now declare their secret and variable
names.
- #4463 and #4496: The Qodo acknowledgment key changed. A
`fleet-finding-ack` already posted on a still-open pull request stops
matching its finding once a caller's hub pin reaches this change. Post
it again, since `merge` refuses until then.
- #4502: Every `gh` child the Python scripts under the hub's `scripts/`
and `spec/` start now runs with `GH_HOST=github.com`, so an exported
`GH_HOST` no longer moves their reads and writes. #4505 pins the repo
gate's own `gh_read` the same way. The `gh-write-guard` hook (#4501) and
the shell and PowerShell scripts are unchanged.
- #4503: The `validate-task.yml` EditorConfig, shell, and PowerShell
lint steps now pull their images through `docker_lint.py --pull`, with
one retry schedule of 3 attempts waiting 15s, then 30s. The
`docker-lint-pins` action gains a `docker-lint` output naming that
script at the calling workflow's own ref. A caller pinned before this
change keeps its inline retry.
- #4505: The `docker-lint-pins` action now reads the pin manifest
through `docker_lint.py --pin` rather than `sed`, so its step runs
`python3`. It now refuses an empty tag or a stage named twice, which the
old `sed` accepted, and on a failure it writes no outputs and one
`::error::` annotation carrying the reason.
- A fleet resync is owed, because carried text changed: AGENTS.md,
GOVERNANCE.md, CODESTYLE.md, and several skills.

## Findings from the local strict review

The attested local pass on c25ec49 (`main...develop`) raised five
findings. Their outcomes:

- Tracked: the hub's own `dependabot.ecosystems` DRIFT on `/tests` is
the question #4459 holds, so it changes nothing here.
- Fixed by #4500: `scripts/enable_hooks.py` `on_signal` now passes over
a signal handled as its first handler starts.
- Fixed by #4503: the bounded Docker pull retry is now written once,
`scripts/docker_lint.py` `pull_image`, with one schedule.
- Fixed by #4502: `spec/audit_environments.py` `names()` is gone, and
both environment readers read through `spec/resolve_secrets.py`
`read_names`.
- Release note: the Qodo acknowledgment key change from #4463 and #4496
is stated under "Release notes for callers" above.

The attested local pass on f93f34a (`main...develop`) raised 57
findings. Their outcomes:

- Declined, 52 `prose_lint` `comment-added` lines: each comment was
added by a feature pull request carrying the `comments` label (#4456,
#4461, #4463, #4465, #4467, #4472, #4480), and the promotion re-carries
them without that label.
- Tracked: `spec/audit_dependabot.py:93`, the hub's own `/tests` pip
drift, is the question #4459 holds.
- Tracked: the nested-signal guard missing at
`scripts/docker_lint.py:416`, `scripts/backlog_metrics.py:1290`, and
`catalog/snippets/hub_fetch_run.py:193` is the class #4452 holds.
- Release note: the Qodo key change at
`scripts/pr_review_answers.py:158` is stated above.
- Fixed by #4505: `.github/actions/repo-gate/repo_gate.py` `gh_read` now
starts its `gh api` child under `gh_env()`, which pins
`GH_HOST=github.com`.
- Fixed by #4505: `scripts/docker_lint.py` `read_pins` is now the pin
manifest's one parser. The repo gate dropped `SHELLCHECK_PIN`, and the
`docker-lint-pins` action dropped its `sed` for `docker_lint.py --pin`.

The attested local pass on 3183644 (`main...develop`) raised 53
findings. Their outcomes:

- Declined, 51 `prose_lint` `comment-added` lines: the same comments the
pass on f93f34a named, less the `docker-lint-pins` `action.yml` line
#4505 removed, each added by a feature pull request carrying the
`comments` label.
- Tracked: the nested-signal guard missing at
`scripts/docker_lint.py:448`, `scripts/backlog_metrics.py:1290`,
`scripts/pr_review.py:2174`, and `catalog/snippets/hub_fetch_run.py:193`
is the class #4452 holds.
- `introduced`, design, `scripts/docker_lint.py:856`: `resolve_digest`
runs one more `docker image inspect` per linter to read a digest the pin
manifest's tag-and-digest reference already gives, since #4461 pins
every image, and it takes `RepoDigests[0]`, which can name another
repository holding the same image. Deferred to #4508 by the maintainer's
decision, which is this finding's outcomes.

Fixes #3468
Fixes #3880
Fixes #4408
Fixes #2070
Fixes #4473
Fixes #4474
Fixes #2594
Fixes #4327
Fixes #4450
Fixes #1783
Fixes #3325
Fixes #3917
Fixes #4448
Fixes #1164
Fixes #1613
Fixes #1727
Fixes #4403
Fixes #4407
Fixes #4158
Fixes #4210
Fixes #4429
Fixes #4406
Fixes #4488
Fixes #4498
Fixes #4489
Fixes #4499
Fixes #4504

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants