Skip to content

fix(dogfood/coder): read Ubuntu packages from Canonical hosts - #31778

Merged
mafredri merged 5 commits into
mainfrom
mafredri/dogfood-apt-single-mirror
Nov 9, 2026
Merged

mafredri merged 5 commits into
mainfrom
mafredri/dogfood-apt-single-mirror

Conversation

@mafredri

@mafredri mafredri commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

The dogfood build on main failed on 2026-11-05 because two apt steps in Dockerfile.base read different sources. The first step used archive.ubuntu.com, and its unminimize upgraded apt to 3.2.1ubuntu0.1. The package install step switched to mirrors.edge.kernel.org, which did not have that version yet, so apt-utils, which requires the exact apt version, could not be installed.

Every apt step now reads Ubuntu packages through apt's mirror+file: method: archive.ubuntu.com first, then Canonical's Azure mirror, falling back per file on any error, including 403. kernel.org is no longer used. 80-retries now sets the keys apt reads, so a failing host is skipped sooner, and both files are copied in before the first apt step.

Decision log

The evidence comes from the 323 retained dogfood build_image logs (2026-08-11 to 11-05), 56 coder/images jobs, live probes and apt 3.2.0 experiments.

  • Why the build hit it: it fell back to an uncached buildx build (fixed in fix(.github/workflows): build dogfood images from the checkout #31777), so both steps ran fresh. Depot's cache usually reuses the first step, but any change to it, or a cache miss, rebuilds both.
  • Why not kernel.org:
    • Depot builders and the Depot runners used by the fallback are in AWS us-east-1, which mirrors.edge.kernel.org (a geo CNAME) sends to dfw.mirrors.kernel.org. At 12:00 UTC on 2026-11-05, dfw had the archive state from 2026-11-03 19:00 and the EU server from 2026-11-04 20:14.
    • In CI, kernel.org's index was smaller than the archive's in 15 of 82 same-build comparisons and never larger.
    • It caused all three Ubuntu-source failures: an outage on 2026-11-03 (connection timeouts to dfw), and version mismatches against the archive on 2026-10-01 (libssl3t64) and 2026-11-05 (apt).
  • The 403s behind fix: improve build reliability with fallback apt mirrors #18155: their logs have expired. archive.ubuntu.com and security.ubuntu.com logged no errors in 55 apt steps each, and no Ubuntu host returned a 403 in any retained log. coder/images, which builds on Depot with the default sources, had one archive timeout incident (2026-09-11). The archive has had public outages since (2025-09-05, 2026-04-17), so a fallback host is kept.
  • Why Azure as the fallback: status.canonical.com lists the Azure mirrors as a Canonical component, and the name is geo-routed (AWS us-east-1 reaches the eastus endpoint). GitHub's runner images use the same mirror+file: setup with these hosts (configure-apt-sources.sh). security.ubuntu.com adds nothing as a fallback because it resolves to the same servers as archive.ubuntu.com.
  • Azure's lag: sampled every 5 minutes from 2026-11-05 11:50 to 2026-11-06 18:45 UTC, the archive published 14 updates to resolute-security and resolute-updates. Azure's US East endpoint, which AWS us-east-1 reaches, served each one 0.3 to 3.0 hours later, and its EU endpoint 0.4 to 1.2 hours later. kernel.org took 0.5 to 8.3 hours (Amsterdam) and 1.1 to 12.3 hours (Dallas) for the same updates, and Dallas started the window 40 hours behind. 9 of 360 samples from Dallas failed; none from the archive or Azure did. Inside that window, a fallback to Azure can still give a later apt step an older index than an earlier step got from the archive, but only if the archive fails for the later step.
  • Alternatives rejected:
    • Several URIs in one stanza: apt takes the newest version across them, but a 403 from any of them makes apt-get update exit 100.
    • snapshot.ubuntu.com: most requests returned 500 to 504 between 11:58 and 12:25 UTC, and a failed snapshot silently falls back to the live archive.
    • kernel.org as the fallback: falling back to it reproduces the version mismatch.
  • Retry settings: APT::Acquire::Retries, the old key, is not read by apt. Acquire::Retries "1" and Acquire::http::Timeout "15" match GitHub's runner images. The timeout only affects the http Ubuntu hosts. The retry count also applies to the HTTPS third-party sources, which have no fallback host.
  • http and ca-certificates: the hosts use http because the base image has no CA certificates before the first apt step. apt still verifies the signed InRelease files. ca-certificates still has to come before copying the rest of files/, whose third-party apt sources use HTTPS. The old comment described a teraswitch mirror override that fix(dogfood): stop overriding /etc/apt/sources.list with tsw mirrors #11999 removed.
  • Checked locally:
    • An uncached docker build through the package install passed. Every Ubuntu fetch went to archive.ubuntu.com, apt-utils 3.2.1ubuntu0.1 installed, and apt-config shows the new retry and timeout values.
    • In that image, with archive.ubuntu.com pointed at:
      • a closed port: apt-get update and a .deb download moved to Azure in 5 seconds;
      • an address that drops packets: apt-get update took 18 seconds and three .deb downloads 17 seconds;
      • a server that accepts connections and never answers: about a minute per file.
    • make pre-commit-light passes.
  • Checked by this PR's CI: build_image built the base image on Depot with no fallback. All 559 Ubuntu fetches went to archive.ubuntu.com, apt 3.2.1ubuntu0.1 installed, and the image tooling tests passed.
  • Not verified: failover from Depot's network, whether Azure's lag stays within these numbers beyond the 31-hour sample, and whether it shares whatever caused fix: improve build reliability with fallback apt mirrors #18155's 403s.

🤖 This PR was created with the help of Coder Agents.

mafredri commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@codex review
/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-11-05 11:44 UTC by @mafredri
Spend: $3.82 / $100.00

Review history
  • R1 (2026-11-05): 9 reviewers, 1 P3, 1 P4, COMMENT. Review

deep-review v0.13.0 | Round 1 | fb36a3d..61388c1

Last posted: Round 1, 2 findings (1 P3, 1 P4), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Open Dockerfile.base:8 Comment says "more reliable mirrors" without the 403 reason from #18155 R1 Gon P2, Leorio P4 Yes
CRF-2 P4 Open Dockerfile.base:33 Package install still fails if it reaches a kernel.org geo server older than the one unminimize used R1 Komugi P4, Hisoka Note, Mafu-san Note, Kite Note Yes
CRF-3 Note Note (body) Dockerfile.base:17 unminimize security updates now come from kernel.org instead of security.ubuntu.com R1 Leorio, Kite No
CRF-4 Note Dropped by orchestrator (merged into CRF-2 evidence) Dockerfile.base:17 unminimize runs its own apt-get update, so there are three index fetches R1 Kite No
CRF-5 OOS Out of scope (body) Dockerfile.base:126 Comment cites nonexistent dogfood/coder/files/... path for 99-chrome-flags R1 Netero No
CRF-6 OOS Out of scope (body) files/etc/apt/apt.conf.d/80-retries:1 Sets APT::Acquire::Retries, which apt does not read R1 Netero No

Contested and acknowledged

None.

Round log

Round 1

Full panel, round 1. Focused (one file, Dockerfile). Netero: no findings, 2 out of scope. Panel: Pariston, Mafuuu, Gon, Leorio, Mafu-san, Hisoka, Komugi, Kite, wildcard Zoro. No domain specialist trigger matched a Dockerfile-only diff.
CRF-1 settled at P3 between Gon P2 and Leorio P4. Keep-argument for P2: the comment is the only in-code record of why kernel.org is used, and without it a maintainer may revert to archive.ubuntu.com. Downgrade reason: the comment is vague, not wrong; Gon's "every apt step" imprecision is resolved by the paragraph's "for Ubuntu packages", and a revert fails visibly in CI with 403s.
CRF-2: five reviewers converged on the geo-DNS residual; Pariston showed failure needs the second step's server to be behind the cached first step's server. Kept at P4 with Komugi's structural alternative.
CRF-6 verified: apt-config dump in the pinned ubuntu:26.04 image with 80-retries mounted shows only APT::Acquire::Retries "3";.
Reviewed against fb36a3d..61388c1.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T11:46:54.467431Z 61388c1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

This comment has been minimized.

coder-agents-review[bot]

This comment was marked as outdated.

@mafredri
mafredri force-pushed the mafredri/dogfood-apt-single-mirror branch from 61388c1 to 00b2ff8 Compare November 5, 2026 12:57
@mafredri mafredri changed the title fix(dogfood/coder): use one Ubuntu mirror for every apt step fix(dogfood/coder): read Ubuntu packages from Canonical hosts Nov 5, 2026
@mafredri
mafredri force-pushed the mafredri/dogfood-apt-single-mirror branch from 00b2ff8 to 5d9b6e3 Compare November 5, 2026 15:25
@mafredri

This comment has been minimized.

@mafredri
mafredri marked this pull request as ready for review November 6, 2026 16:52
The first apt step read archive.ubuntu.com and the later package
install read mirrors.edge.kernel.org. On 2026-11-05 unminimize
upgraded apt to 3.2.1ubuntu0.1 from the archive, the kernel.org mirror
did not have that version yet, and installing apt-utils, which
requires the exact apt version, failed the main build.

Switching the sources before the first apt-get update makes every step
read the same mirror. The removed comment referred to a teraswitch
mirror override that was dropped in #11999.
The kernel.org mirror that every apt step now reads lags the archive by
more than a day: at 2026-11-05 12:00 UTC the server that AWS us-east-1
reaches had the archive state from 2026-11-03 19:00, and it caused all
three Ubuntu-source failures in the retained CI logs. No Ubuntu host
returned a 403, the reason the kernel.org switch was made, in any
retained log.

Use apt's mirror+file method instead: archive.ubuntu.com first, then
Canonical's Azure mirror, which falls back per file on any error,
including 403. Both serve the archive's current state, so a fallback
cannot hand a later step an older index than an earlier step used.

80-retries set APT::Acquire::Retries, which apt does not read. Set
Acquire::Retries and the http timeout so a failing host is skipped
sooner, and copy both files in before the first apt step.
The previous commit said both mirror hosts serve the archive's current
state. The Azure mirror picked up the archive's 11:49 UTC
resolute-updates publication between 12:43 and 12:53 UTC on
2026-11-05, so a fallback can still read a slightly older index.
The comments narrated the investigation. State instead what each line
keeps true for someone changing it: why the mirror list is copied
before the first apt step, which hosts may be listed and why they use
http, and why the retry values are low. The measurements stay in the
PR description.
The comment gave one reason for two files. Both are copied before the
first apt step so that step also uses the mirror list and its retry
settings.
@mafredri
mafredri force-pushed the mafredri/dogfood-apt-single-mirror branch from 5d9b6e3 to 709e554 Compare November 6, 2026 18:56
@mafredri
mafredri merged commit a3aab79 into main Nov 9, 2026
32 checks passed
@mafredri
mafredri deleted the mafredri/dogfood-apt-single-mirror branch November 9, 2026 11:24
@mafredri
mafredri temporarily deployed to main November 9, 2026 11:24 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 9, 2026

This branch was previously deployed

1 inactive deployment
main — 709e5545 Deployed Nov 9, 2026 by mafredri via cla #252404
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants