Repository navigation
ci(linux): install cached desktop packages without an apt index refresh - #5021
Conversation
The Smoke job failed when a slow Ubuntu mirror could not finish `apt-get update` within 3x30s, although the restored archive cache already held every package the step needs. Install the cached .debs directly, and refresh the index only when they do not cover the package set. The cache key is unique per run attempt so a refreshed set replaces a stale one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
…tall Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16ae1db to
fba967a
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 16ae1db. The verdict and the full list are in the summary comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
The cached-install route in 5564e2c passes in CI, but six defects remain in how it falls back. All 21 checks pass at this commit, including the Linux Smoke Tests job whose route the diff changes. There are no conflicts. The fixes below must land before merge. A second independent pass found that line 129 installs every restored archive as an explicit root target. The saved set holds every archive in the system archive directory, so an unrelated archive already on the runner at save time is later installed too. The check at lines 119-123 can still pass. The merge base requested only PACKAGES. Request only PACKAGES from APT, with the restored archives as candidates and authenticated local package metadata, and save only the archives selected for that dependency set. A second independent pass found that line 126 copies restored archives into the system archive directory before the install. If an archive has valid control data but damaged package data, dpkg fails on it. The fallback's download-only step at line 139 then accepts the same file because its name and size match, and the install at line 141 fails on it again. Keep restored archives in an isolated archive directory. When the cached install fails, discard that directory and run the fallback with a clean one, so APT fetches and verifies a replacement. A second independent pass found that line 139 can fail after the cached install is interrupted. If dpkg is killed with a dirty status journal, APT refuses the download-only step when it opens the package database, so the refreshed package set never reaches the final install. After a cached install fails, check for interrupted dpkg state and recover it before starting the named-package fallback. A second independent pass found that line 128 skips the all_installed check when the archive directory is empty. A runner image that already has all ten packages, with an absent or empty saved entry, refreshes indexes anyway. If the mirror stalls on both attempts, the job fails although the package set was complete. A successful run can also save an empty entry under a new key at lines 145-156. Check all_installed before probing the archive glob and exit successfully when it passes. Save a replacement entry only when there are archives to save. A second independent pass found that line 129 lets the cached attempt spend the dpkg lock wait set at line 91 plus the time to install a partial set before all_installed rejects it. With two network phases near 120 seconds each, the fallback can be left with under 50 seconds. It still allows another lock wait at line 141, so the six-minute step at line 83 can end before the fallback dpkg starts. Kill grace at line 112 adds to this. Check the offline package plan before starting dpkg, then budget the cached attempt, both retry windows, the kill grace and the final lock wait together, and reserve time for the final dpkg run and the cache copy. A second independent pass found that line 141 runs the final install with downloads enabled. If another process changes the package indexes or removes a prefetched archive after line 139, apt-get can contact the mirror outside apt_bounded. A slow but steady transfer then avoids the per-I/O timeouts at lines 88-89 and can use the rest of the step. The call exists on the merge base, but here it breaks the bounded network-phase rule. Use a job-private archive directory for prefetch and install, pass --no-download to the final install, and send any newly missing archives through the bounded download phase. A second independent pass found that line 139 shortens the download window to 60 seconds per attempt. A transfer that needs 67 seconds with steady progress, on a mirror that restarts partial transfers, fails both attempts. The merge base allowed 75 seconds per attempt and finished that job. Keep at least the former 75-second window for a single transfer, account for it in the step budget, and keep time for dpkg. Not blocking, and these can be taken or left: the comment at line 140 counts only the apt_bounded windows and omits the kill grace and both dpkg lock waits, so "about two minutes without a dpkg lock wait" is more accurate; the comment at line 125 says apt resolves local .debs only through its archive directory, but the copy matters for the fallback's download-only step and for dependencies not on the command line; the cached install can refuse a downgrade of a library the runner image already upgraded, which falls back to a refresh by design; and the saved .debs are frozen, so mirror security updates arrive only on a scheduled refresh on main if freshness matters. Not verified here: the "cached install fails, so refresh" route was not observed live, only the miss route (run 45178372896, on a temporary key) and the hit route. That route was read from the code only. The workflow was not run locally, and APT downgrade and archive-reuse behavior comes from reading APT, not from running it. The restore-keys ordering of the cache backend was not checked separately beyond the live log. The earlier inline thread on the download windows is fixed in 5564e2c, since the windows are now 2x60s and total 240s; it can be resolved: #5021 (comment) |
Cache the authenticated package lists with the archives apt selected for the package set, keep both outside the system directories, and install only when the offline plan needs no download. A failed cached install recovers dpkg state and falls back to a clean archive directory. Every install runs with --no-download, and the step budget covers every lock wait and network window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26d7279 to
0c429fe
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0c429fe to
77b7c0a
Compare
This comment has been minimized.
This comment has been minimized.
|
Addressed in 77b7c0a. Each finding and its fix:
Non-blocking notes: I took the comment corrections. A downgrade refusal and frozen archives fall back to a refresh by design. The refresh that healed the entry took 43s, which the old 30s window would have failed. |
|
All seven findings from the earlier review (#5021 (comment)) are fixed at 77b7c0a. A second independent pass found two defects that still need a change. A second independent pass found that the restored-archive install does not verify contents. A restored archive with the expected filename and byte count but changed contents passes the plan at line 126, because APT treats an existing archive as complete on a size match. Line 130 then hands those bytes to dpkg. Restored package lists have the same gap at lines 83 and 104: APT trusts a source by the presence of InRelease or Release.gpg and does not re-verify a restored Packages list during install. The rule: before the restored install, verify the Release signatures with the configured Ubuntu keyring, verify the restored package lists against those signed digests, and check the SHA-256 of every selected archive against its verified package record. Send any verification failure to the existing clean fallback. Refs: APT archive lookup, APT local source trust check. A second independent pass also found that the fallback can change package indexes between download and install. Line 163 clears LIST_OPTS, so the bounded download and the plan check at line 169 use the runner's live indexes. If the periodic index update publishes a newer candidate for a missing package after that check, line 171 needs an archive the private directory lacks. APT then exits under --no-download and the step fails even when the mirror is healthy. The earlier review named this route. A refresh after install but before line 177 can also save lists that select different versions from the archives just downloaded. The rule: the fallback download, plan, install and save must all use one job-private refreshed list directory, and the install keeps --no-download. Refs: periodic index update, missing archives under --no-download. The earlier thread on the 2x60s refresh windows (#5021 (comment)) no longer applies: the windows are unchanged and the 410s of 540s budget is now counted explicitly. It can be resolved. All 22 checks pass or skip at 77b7c0a, including the Smoke Tests job whose install step this diff rewrites (run 45192864063, attempt 4). The diff touches only .github/workflows/linux.yml. No conflicts. Both findings need a fix before merge, and the Smoke Tests job should then show the restored-install route and the fallback route each succeed, with the integrity checks running on the restored route. Not verified here: the workflow was not run locally, and the APT behavior above comes from reading APT and the author's live runs. The logs of runs 45190712904, 45192438725 and attempts 1-3 of 45192864063 were not read, so the corrupted-archive recovery and the refresh and cold-path timings are the author's claims. The restore-keys ordering across ref scopes was not checked beyond the author's runs. |
…s job-private Check each restored InRelease against the Ubuntu keyring, each Packages list against its signed digest, and each archive against the SHA-256 in its package record before the restored install. The fallback refreshes into the job-private list directory, so the download, plan, install and save all use one index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b6b3ac0 to
ad49f00
Compare
|
Both findings are addressed in e48894d. ad49f00 only adds a log line.
I resolved the earlier thread on the refresh windows. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on b6b3ac0. The verdict and the full list are in the summary comment.
|
Both findings from the earlier review (#5021 (comment)) are fixed at ad49f00, but three new defects remain in the restore check. A second independent pass found them, and each lets a restored install skip verification. A second independent pass found that a restored set can carry a compressed Packages list for another configured pocket with no plain counterpart. The check skips it, APT reads it when resolving the plan, and a record from it can complete the offline install even if its digest differs from the signed Release. The previous save copied compressed lists, so such sets exist. Please reject unexpected list files on restore before calling APT, or point the restored install at a directory that holds only verified list and release files. APT index lookup A second independent pass found that an archive path expected for a selected dependency can hold a different Ubuntu package of the same byte count. Its own identity and SHA-256 sit in a verified list, so the check passes. APT accepts the file by basename and size and can hand it to dpkg before the fallback runs. The rule: look up the expected SHA-256 by the archive identity and filename APT selects, using APT's filename escaping, and reject a restored file whose digest differs. APT archive lookup A second independent pass found that if awk hits a write error after it emits the rows the archives need, it exits nonzero but leaves those rows behind. Because verify_restored runs inside an if condition at line 179, Bash ignores errexit there, so the lookups can pass on partial output and the install proceeds. Please return failure explicitly when record extraction fails, and check the exit status of the verifier's other setup and extraction commands the same way. Bash errexit behavior Checks are green on ad49f00. Earlier cancelled rows came from a newer push superseding the first runs, and the re-run at the same commit passed every job. The diff touches only the Linux workflow, which the Linux Smoke Tests job runs. No conflicts. These three fixes must land before merge. Of the earlier inline threads, none still apply. The thread at #5021 (comment) targets a temporary debug line from b6b3ac0, which is not in this head. The thread at #5021 (comment) is fixed by the 9-minute timeout and the 410s count in the step comment. Not verified here: the workflow and script were not run locally, and the findings rest on reading the head script and the logs of the restored-route and tampered-archive runs. Not verified here: the repair route ( |
Reject any restored list file other than InRelease and plain Packages, match each archive to the record whose escaped file name apt selects, and check every command's status inside the verifier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24f8bfa to
3eeb9b0
Compare
Apex Sentinel · ⛔ Block · review of
|
| Where | Finding |
|---|---|
.github/workflows/linux.yml:182 |
Temporary swapped-archive check fails every cold-cache run and disables the cached route |
Reviewed with this repository's own Sentinel configuration (0d38f89b11da).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 finding moved to a new line on 24f8bfa. The verdict and the full list are in the summary comment.
|
All three are fixed in 29b5e25 and 3eeb9b0:
Live evidence:
Both temporary commits are dropped. I resolved the two stale threads. |
|
The three defects from the earlier review (ad49f00, #5021 (comment)) are fixed at 3eeb9b0. The Linux Smoke Tests install step now installs the cached desktop packages without an apt index refresh, and the live run passed with epoch-escaped package names (41 archives verified). CI is green at this commit: both Linux Smoke Tests runs, iOS, macOS and Coverage pass; the other non-passing rows come from superseded runs of earlier pushes. There are no conflicts. Nothing remains to fix before merge. Of the two open inline threads, neither still applies, so the author can resolve both. The temporary swapped-archive line is gone from the workflow at this commit (#5021 (comment)). The timing concern is covered by the 410s of 540s budget in the workflow (#5021 (comment)). Not verified here: the job logs of the dropped temporary-commit runs, and the exact apt quoting rules in the apt source. The review relied on the author's reported output and the green runs at this commit. |
Summary
Smoke failed in 21 of the last 60 Linux runs. Each sampled failure (45166777462, 45157212041, 45145924854) hit
apt-get update did not finish within 30s on 3 attempts. In job 137665639883, a slowarchive.ubuntu.commirror killed each attempt mid-InRelease. Green runs then needed0 Bof archives: the cache already held every package.The cache holds the Ubuntu lists of the last refresh and the archives apt selected for PACKAGES. A run accepts only InRelease and plain Packages lists. It checks each InRelease with
gpgv, each list against its signed digest, and each archive's SHA-256 against the record for the escaped file name apt looks up. It installs with--no-downloadonly when--print-urisplans no download. Any failure recovers dpkg state, discards the set, and refreshes, downloads, installs and saves through one job-private directory. The step budget covers every lock wait and window (410s of 540s).Before / after
No observable change to the product.
Validation
Head 3eeb9b0: run 45215082154, attempts 1–3 all green (
verified 15 lists and 41 archives).Temporary commits, now dropped, tested rejected sets:
.lz4list (45214284821)Run 45213544759 rejected a stale entry, and run 45192438725 tested dpkg repair.
🤖 Generated with Claude Code