Skip to content

ci: guard apt-get network bounds instead of trusting a comment - #11947

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/m4-air/ci-apt-retry
Aug 20, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/m4-air/ci-apt-retry

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

The hang

apt has no built-in timeout. Against the hosted runners' default Azure Ubuntu mirror it can connect and then never complete the transfer, so the step emits no further output and the job runs to its ceiling — six hours, where no explicit timeout-minutes exists — then reports cancelled. That reads as an infrastructure mystery rather than a stalled mirror.

Observed on Linux package · helper smoke at exactly 6h00m15s, and on Replay Harness Phase 0A at its tighter 20-minute cap, on main and on several unrelated PRs.

What was already fixed, and what was missed

#11872 fixed this by hand in two workflows. It left one line unbounded:

# Bound apt's network calls explicitly: a stalled mirror connection
# ... hangs with no output and no built-in timeout, burning the full 6h
sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=15 ... update
sudo apt-get install -y imagemagick fonts-dejavu-core tesseract-ocr ...   # <- unbounded

The comment was already true of one line and false of the next, and nothing could tell.

The change

Bound that line, and add a check that derives the requirement from the source signal — an apt-get subcommand that touches the network — so a newly added call cannot be unbounded and nobody has to remember.

Each such line must carry Acquire::Retries plus http and https acquire timeouts, and its step must declare timeout-minutes as a backstop for what the acquire options do not cover: dpkg, a debconf prompt, a wedged post-install.

clean and autoremove touch no mirror and are deliberately left alone.

Verification

Run against the tree, the guard found exactly one offender — the line above — and no false positives across 69 workflow files. After the fix: clean.

The self-test asserts the exact regression shape (update bounded, install forgotten) rather than only asserting today's tree is clean, so the guard cannot pass by accident once the tree is fixed. 10 tests.

Failure-Class: none

Review in cubic

Git-on-my-level and others added 2 commits August 20, 2026 15:26
apt has no built-in timeout. Against the hosted runners' default Azure Ubuntu
mirror it can connect and then never complete the transfer, so the step emits no
further output and the job runs to its ceiling - six hours, where no explicit
timeout-minutes exists - and reports `cancelled`, which reads as an
infrastructure mystery rather than a stalled mirror.

#11872 fixed this by hand in two workflows. It left one line unbounded:
desktop-windows-ci.yml bounds its `apt-get update` and not the `apt-get install`
directly beneath it, under a comment that says "Bound apt's network calls
explicitly". The comment was already true of one line and false of the next, and
nothing could tell.

Bound that line, and add a check that derives the requirement from the source
signal - an apt-get subcommand that touches the network - so a newly added call
cannot be unbounded and nobody has to remember. Each such line must carry
Acquire::Retries plus http and https Acquire timeouts, and its step must declare
timeout-minutes as a backstop for what the acquire options do not cover (dpkg, a
debconf prompt, a wedged post-install).

`clean` and `autoremove` touch no mirror and are deliberately left alone.

The self-test asserts the exact regression shape - update bounded, install
forgotten - rather than only asserting today's tree is clean, so the guard cannot
pass by accident once the tree is fixed.

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
The check failed in CI with `No module named pytest`. Two mistakes, both mine:
it was written against pytest when nothing in checks-manifest.yaml uses pytest,
and it was verified locally with the backend venv rather than the bare `python3`
the preflight runner actually invokes.

Convert the self-test to stdlib unittest, matching every sibling in
.github/scripts, and route it through a wrapper that resolves the canonical
backend interpreter and provisions it when PyYAML is absent - the same shape as
scripts/run-release-process-guards.sh, which is the existing precedent for a
guard that needs the repository's locked PyYAML.

The self-test carries the tree-wide case, so the wrapper is both the proof and
the enforcement. Verified by reintroducing the unbounded install line: the
wrapper fails, and passes again once bounded.
@Git-on-my-level
Git-on-my-level merged commit b986d8f into main Aug 20, 2026
29 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m4-air/ci-apt-retry branch August 20, 2026 20:55
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