Skip to content

ci(package): retry apt fetches and docker builds behind the Ubuntu mirror - #18797

Merged
nwparker merged 1 commit into
mainfrom
ci/docker-apt-retry
Sep 5, 2026
Merged

nwparker merged 1 commit into
mainfrom
ci/docker-apt-retry

Conversation

@nwparker

@nwparker nwparker commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​38

ELI5

When Ubuntu's package mirror is mid-sync, the three Docker images the package job builds either hang downloading packages or fail with a corrupt index. Now each image retries the index refresh a few times (with per-download timeouts) and the runner scripts retry the whole docker build once, so a flaky mirror no longer fails unrelated PRs.

What Changed

  • config/docker/cli-launch-contract/Dockerfile, config/docker/headless-serve-shutdown/Dockerfile, config/docker/headless-pairing/Dockerfile: the bare apt-get update is now a bounded 5-attempt loop with -o Acquire::Retries=5 -o Acquire::http::Timeout=30, clearing /var/lib/apt/lists/* between attempts so a half-synced index is never reused. apt-get install gets the same acquire options. Package lists are byte-identical; FROM, ARG, ENV, useradd, COPY, ENTRYPOINT untouched.
  • config/scripts/run-linux-cli-launch-contract-docker.mjs, config/scripts/run-headless-serve-shutdown-docker.mjs, config/scripts/run-headless-linux-pairing-docker.mjs: docker build is retried once on failure or timeout; the first error is logged before the retry, and only a second failure throws.

Why

Six package job failures across four PRs tonight, all inside the Dockerfile RUN apt-get update && apt-get install ... against archive.ubuntu.com (91.189.91.81), in three shapes:

There was no retry, mirror, cache, or apt timeout anywhere (Acquire::Retries|type=cache|mirror|sources.list|apt-get -o has zero hits under config/docker/ and config/scripts/run-*docker*.mjs). apt's own Acquire::Retries covers transient per-file failures; the outer loop covers the index-level Hash Sum mismatch / wrong-size cases where apt refuses to proceed; the build-level retry covers a whole-image stall. No GitHub-Azure-only mirror, registry auth, or BuildKit cache mounts, because the reliability gate in config/reliability-gates.jsonc also records local runs of these scripts.

Linked Issue

N/A — CI infrastructure flake. Blocked PRs: #18739, #18744, #18747, #18764.

Visual Proof

N/A — CI-only change, no UI or user-facing behavior.

Testing

  • docker build -f config/docker/cli-launch-contract/Dockerfile config/docker/cli-launch-contract succeeds locally (macOS, Docker Desktop); the apt RUN layer completed in 16 s on the first attempt.

  • node --check on the three .mjs runners; oxfmt --check and oxlint clean on them.

  • pnpm run check:code-quality:changed: 0 new findings across 3 changed files (oxlint, type-aware, React Doctor).

  • CI on this PR exercises all three images via the package job.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below — no unit tests: the change is a Dockerfile shell loop and a docker build retry in CI runner scripts; the package job on this PR is the test.

Negative user-facing trade-offs

None for users. CI cost: only when the mirror is unhealthy, up to 5 × 20 s of extra sleep per image plus one extra docker build attempt (bounded by the existing 10-minute build timeout). On a healthy mirror the build is unchanged.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…rror

The package job builds three Docker images whose apt-get update/install
hit archive.ubuntu.com with no retry, timeout, or mirror fallback. When
the mirror is mid-sync every build dies in one of three ways:

- per-package fetch stalls (~64 s each, `Ign:` lines) until the runner's
  10-minute docker build timeout fires:
  https://github.com/stablyai/orca/actions/runs/33935104546/job/101221447425
- `apt-get update` exit 100 with `Hash Sum mismatch` on
  noble-updates/restricted/Packages.gz:
  https://github.com/stablyai/orca/actions/runs/33935104546/job/101226099525
- `apt-get update` exit 100 with `File has unexpected size ... Mirror
  sync in progress?`:
  https://github.com/stablyai/orca/actions/runs/33935244026/job/101231083497

Each Dockerfile now retries `apt-get update` up to five times with
Acquire::Retries and a 30 s HTTP timeout, clearing /var/lib/apt/lists
between attempts so a half-synced index is never reused, and passes the
same acquire options to `apt-get install`. Each runner script retries the
whole `docker build` once when the first attempt fails or times out.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: d142104b-97c9-45c2-aa53-0bba3f1e91c5

📥 Commits

Reviewing files that changed from the base of the PR and between 436ef82 and c5f05c7.

📒 Files selected for processing (6)
  • config/docker/cli-launch-contract/Dockerfile
  • config/docker/headless-pairing/Dockerfile
  • config/docker/headless-serve-shutdown/Dockerfile
  • config/scripts/run-headless-linux-pairing-docker.mjs
  • config/scripts/run-headless-serve-shutdown-docker.mjs
  • config/scripts/run-linux-cli-launch-contract-docker.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Dockerfiles now retry apt-get update up to five times, clear partial APT lists, and use bounded retry and timeout settings for update and install operations. Docker validation scripts now store Docker build arguments, report failed builds, and retry each build once.

Merge Risk: ⚪ Minimal · up to c5f05

Docker image builds now tolerate transient Ubuntu mirror and build failures through bounded retries while preserving final failure behavior. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main changes: retrying APT fetches and Docker builds to handle Ubuntu mirror failures.
Description check ✅ Passed The description is mostly complete and covers the change, motivation, testing, visual proof, trade-offs, review considerations, and checklist. The Linked Issue section contains no actual issue link, b…
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: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

Comment @coderabbitai help to get the list of available commands.

@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

  • Bounded apt retry loop in the three package-job Dockerfiles — apt-get update is now a 5-attempt loop with Acquire::Retries=5 and Acquire::http::Timeout=30, clearing /var/lib/apt/lists/* between attempts so a half-synced index is never reused; the trailing list cleanup is preserved and the FROM/ARG/ENTRYPOINT surface is untouched.
  • One docker build retry in the three runner scripts — each script retries a failed or timed-out build once, logging the first failure before the second attempt; only a second failure surfaces as an error.

The shell loop is correct: Docker runs RUN via /bin/sh -c without set -e, so apt-get update && break falls through to the retry branch on failure, break exits the loop with status 0 so done && apt-get install runs on success, and exit 100 only fires on the fifth failure. The two different retry mechanisms in the .mjs files are each the right shape for their docker() helper (the pairing and CLI scripts throw; run-headless-serve-shutdown-docker.mjs must use allowFailure because its fail() sets process.exitCode, which a try/catch would leave set on a recovered retry). The remaining bare apt-get update sites (config/docker/headless-pairing/Dockerfile.build, the ubuntu:20.04 floor-smoke) are out of scope — the former is unreferenced and the latter is release-cut-only and already wrapped in nick-fields/retry@v4.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 41b5202 into main Sep 5, 2026
53 of 55 checks passed
@nwparker
nwparker deleted the ci/docker-apt-retry branch September 5, 2026 05:24
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…rror (stablyai#18797)

The package job builds three Docker images whose apt-get update/install
hit archive.ubuntu.com with no retry, timeout, or mirror fallback. When
the mirror is mid-sync every build dies in one of three ways:

- per-package fetch stalls (~64 s each, `Ign:` lines) until the runner's
  10-minute docker build timeout fires:
  https://github.com/stablyai/orca/actions/runs/33935104546/job/101221447425
- `apt-get update` exit 100 with `Hash Sum mismatch` on
  noble-updates/restricted/Packages.gz:
  https://github.com/stablyai/orca/actions/runs/33935104546/job/101226099525
- `apt-get update` exit 100 with `File has unexpected size ... Mirror
  sync in progress?`:
  https://github.com/stablyai/orca/actions/runs/33935244026/job/101231083497

Each Dockerfile now retries `apt-get update` up to five times with
Acquire::Retries and a 30 s HTTP timeout, clearing /var/lib/apt/lists
between attempts so a half-synced index is never reused, and passes the
same acquire options to `apt-get install`. Each runner script retries the
whole `docker build` once when the first attempt fails or times out.
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