Repository navigation
ci-flake: recycle the native-audio apt cold download off degraded mirror connections - #23406
Conversation
…ror connections Three backend-unit shards died on 2026-10-23 to the same signature (39951629124 shard 1, 39954484165 shard 2, 39929405042 shard 4): after the only ubuntu24 actions/cache entry was evicted, the cold 62.8 MB apt download rode one pipelined TCP connection per mirror host, that connection trickled (shard 1: Gets 6->11 took 4m15s; Acquire::http::Timeout only bounds silent reads), and the step's 5m ceiling killed the install mid-download while same-run siblings finished the identical set in ~60-90s. recycle_apt now runs the network-bearing apt commands under timeout(1) slices and restarts them until a shared 450s budget: completed .debs persist in Dir::Cache::archives, so each restart resumes on a fresh connection. Step ceiling 5m->10m bounds the recycled cold path at ~570s; the shard job ceiling 20m->25m keeps the hang bound above worst setup plus the unchanged 720s test budget, re-pinned in the nightly contract's INTENTIONAL_BUDGET_CHANGES with the measured arithmetic. Warm dpkg replay stays network-free.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a6fb978d0
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| local rc=1 | ||
| while [ "$SECONDS" -lt "$COLD_BUDGET" ]; do | ||
| rc=0 | ||
| sudo timeout --signal=TERM --kill-after=15 "${SLICE}s" apt-get "$@" || rc=$? |
There was a problem hiding this comment.
Recover dpkg before recycling a timed-out install
When a 120-second slice expires after apt-get install has moved from downloading into unpacking or configuring packages, this terminates apt/dpkg mid-transaction. GNU timeout --help confirms that it terminates the command at DURATION and sends KILL after --kill-after; an interrupted dpkg journal then causes subsequent apt operations to fail until dpkg --configure -a is run. Because the next iteration only repeats the same apt-get install, it can return rc 100 repeatedly until the shared budget expires, so a recovered mirror still leaves the shard red. Slice a download-only phase, or repair the interrupted dpkg state before retrying installation.
Useful? React with 👍 / 👎.
| # 2026-10-23) and teardown; slow TEST steps still fail loudly through | ||
| # the step's own 720s budget check, so this ceiling stays a hang bound, | ||
| # not the gate. | ||
| timeout-minutes: 25 |
There was a problem hiding this comment.
Leave room for cache save and post-job cleanup
At the cold-path bounds documented here, checkout (72s) + toolchain (~90s) + apt (~570s) + the allowed test wall (720s) totals 1,452s, leaving only 48 seconds of this 1,500-second job ceiling. On shard 1 after a cache miss, the 62.8 MB actions/cache/save step must still run before the tests, and setup-uv/checkout post-action cleanup runs afterward; neither is included in that sum. If those mandatory operations take more than 48 seconds, the job is cancelled while the test step is still within its 720-second budget, recreating the exact cancellation mode this timeout increase is intended to prevent.
Useful? React with 👍 / 👎.
Cold native-audio setup repeatedly stalls on `azure.archive.ubuntu.com`, even after #23406 recycles the connection. Use one distro-stable `.deb` cache shared from main and official Ubuntu HTTPS archives for cold downloads, scoped to this step through apt source overrides. PRs restore but no longer save isolated merge-ref copies; main shard 1 seeds the cache immediately after installation and before tests. The v1 restore prefix preserves existing cache entries during migration. Confirmed using `gh api repos/BasedHardware/omi/actions/jobs/<id>/logs`: - [40009383869 shard 3](https://github.com/BasedHardware/omi/actions/runs/40009383869/job/120606259502) and [shard 4](https://github.com/BasedHardware/omi/actions/runs/40009383869/job/120606259943): repeated exit 124 while downloading from Azure. - [40008071034 shard 6](https://github.com/BasedHardware/omi/actions/runs/40008071034/job/120600994041): the same sliced-download exhaustion. - [39988312512 shard 1](https://github.com/BasedHardware/omi/actions/runs/39988312512/job/120533188801) and [39973040401 shard 1](https://github.com/BasedHardware/omi/actions/runs/39973040401/job/120485896649): old five-minute timeout during Azure downloads. Healthy siblings finish native setup. - Cache inventory on October 23 showed seven PR-scoped copies for one main entry. A stable key cannot prevent every quota eviction; the alternate cold source remains necessary. Addresses both Codex P2s on #23406: only `update` and `install --download-only` run in timeout slices; dpkg installation runs once offline with `--no-download`, and failed cache replay runs `dpkg --configure -a` before dependency repair. Each slice is clamped to the remaining 300-second download budget. The whole native step is capped at seven minutes, leaving 198 seconds after the observed 72-second checkout, 90-second toolchain and allowed 720-second test wall inside the unchanged 25-minute job ceiling. David's 2026-10-22 standing ruling: every caught CI flake gets fixed at the root; caching CI dependencies is approved. This change stays within the native-audio setup/cache steps. No new workflow, test omission, or merge action. Failure-Class: FC-gate-timeout-below-cold-cost Product invariants affected: none. Why isn't this a shared primitive instead? The workflow's native-audio bootstrap is the shared implementation for all six shards and nightly reuse. Behavioral coverage exercises that exact shell through the existing nightly contract suite, including offline replay, failed-replay recovery, download retry, exhausted-budget failure and job margin; no additional gate or workflow is introduced. Validation: - `omi-heavy run -- nice -n 19 make setup-backend` — locked Python 3.11 environment installed. - `omi-heavy run -- nice -n 19 python3 scripts/ci/test_nightly_main.py` — 22 tests passed, including all seven native-audio cases (also run by preflight). - `actionlint -shellcheck '' .github/workflows/backend-unit-tests.yml` — passed. - `python3 .github/scripts/check_ci_budget.py --refresh` — passed; budget manifest unchanged. - `omi-heavy run -- nice -n 19 env OMI_PR_BODY_FILE=/tmp/flake-native-audio-pr.md make preflight` — all 26 selected checks passed on the final commit. - `scripts/pr-preflight --pr-body-file /tmp/flake-native-audio-pr.md` under `omi-heavy` — all 26 checks passed. - Normal managed `git push` under `omi-heavy` — passed all hooks, including backend Pyright (zero errors), eight selected backend unit test files and actionlint; no bypass flags. Local shell tests mock privileged commands and network; an actual Ubuntu install remains for PR CI. The separate [main shard 5](https://github.com/BasedHardware/omi/actions/runs/40009383869/job/120606259863) 741-second test wall versus its 720-second regression budget is outside this dependency-download fix and remains visible. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23446?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/23446?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23446&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
The
Backend Unit Testsshard job'sInstall native audio replay dependenciesstep died three times on 2026-10-23 with the identical signature (##[error]The action 'Install native audio replay dependencies' has timed out after 5 minutes.mid-download againstazure.archive.ubuntu.com):Flake, not a regression: in run 39951629124 itself, shard 5/6 ran the identical cold download (same total cache miss on both the primary key and the
restore-keysprefix) and finished the whole 62.8 MB set in ~60-90s on a healthy connection. The trigger was the eviction of the repo's onlynative-audio-apt-v1-*-ubuntu24-*cache entry (a fresh one was saved by a main run at 12:50Z, after which runs went warm again): with no cache, every shard cold-downloads, and the ones whose apt connection lands on a degraded mirror path crawl below the 5m ceiling.Why the existing bounds don't cover it: apt rides one pipelined TCP connection per mirror host, and
Acquire::http::Timeout=30only bounds silent reads — a trickling connection never trips it (shard 1 fetched a 66 kB package in 1.2s, then spent 4m15s on the next four).Changes
backend-unit-tests.yml, only inside this flake's own step (plus the one contract line that pins the job's budget):recycle_aptconnection recycling for the network-bearing commands (updateand cold/repairinstall): each runs undertimeout --signal=TERM --kill-after=15 120sand is restarted until a shared 450s step-wall budget. Completed.debs persist inDir::Cache::archives, so every restart resumes the download rather than starting over, on a fresh mirror connection — converting an indefinite crawl into bounded slices. A control-flow simulation (stubapt-get: two crawling invocations, then success) confirms kill/restart/recover and bounded failure when the mirror never recovers.dpkg -iwith no network at all; recycling only engages when the replay fails or the cache is cold.scripts/ci/test_nightly_main_workflow.py'sINTENTIONAL_BUDGET_CHANGES(the reviewed path this registry exists for): 25m keeps the hang bound above worst-plausible setup (72s worst checkout + ~90s toolchain + ~570s apt) plus the unchanged 720s test budget, preserving the invariant documented on the job. The 720s step regression gate is unchanged and warm-path walls are identical, sobudget_p50stays 8 in.github/ci-budget.yaml(no fixture change needed — timeouts are not a pinned field)..githubis edited only for this flake's own step, no workflows added, per the 10-22 CI flake-fix and caching direction from David.Verification
actionlintclean;bash -non the rewritten run block; recycle loop simulated with stub commands (recover and bounded-exhaustion cases).scripts/ci/test_nightly_main_workflow.py(5 tests),.github/scripts/test_check_ci_budget.py+test_check_workflow_apt_network_bounds.py(30 tests) pass locally with the locked backend venv.scripts/run-workflow-apt-network-bounds.shOK across all 84 workflows / 12 composite actions (the step keeps itstimeout-minutes).scripts/pr-preflight --suggest: ci lane, no product-invariant citations, no failure-class declaration required.Risk
dpkg-unpack only in the narrow window where a slice expires after the download completes; the next iteration'sinstall -y -fresolves the partial state, and the same repair already existed for the replay-failure path.