Skip to content

fix: add apt-get install retry logic to handle stale package archives#682

Merged
Mossaka merged 2 commits intomainfrom
fix/agent-dockerfile-apt-retry
Feb 10, 2026
Merged

fix: add apt-get install retry logic to handle stale package archives#682
Mossaka merged 2 commits intomainfrom
fix/agent-dockerfile-apt-retry

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 10, 2026

Summary

  • Adds retry logic to apt-get install in both agent and squid Dockerfiles
  • On install failure, clears the apt cache (rm -rf /var/lib/apt/lists/*), re-runs apt-get update to fetch the current package index, and retries the install
  • Fixes transient build failures caused by Ubuntu archive superseding package versions between apt-get update and apt-get install (e.g., libexpat1_2.4.7-1ubuntu0.7 returning 404 in jammy-security)

Root Cause

The smoke-claude workflow run failed during docker compose up -d because the agent container build couldn't fetch libexpat1_2.4.7-1ubuntu0.7_amd64.deb — it had been superseded in the Ubuntu 22.04 security archive. The apt-get update fetched a package index referencing the old version, but by the time apt-get install tried to download it, the .deb file was already gone (HTTP 404).

Test plan

  • Verify agent container builds successfully with --build-local
  • Verify squid container builds successfully with --build-local
  • Run smoke tests to confirm end-to-end workflow

🤖 Generated with Claude Code

Ubuntu package archives can supersede package versions between apt-get
update and apt-get install, causing 404 errors (e.g., libexpat1 in
jammy-security). Add retry logic that clears the apt cache and re-runs
apt-get update on install failure to fetch the current package index.

Applies to both agent and squid container Dockerfiles.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 10, 2026 23:09
@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.18% 82.18% ➡️ +0.00%
Statements 82.24% 82.24% ➡️ +0.00%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 74.54% 74.54% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Docker image build reliability by adding a retry path for apt-get install to mitigate transient 404s when Ubuntu package archives change between apt-get update and apt-get install.

Changes:

  • Add a one-time retry for apt-get install in the agent Dockerfile, including refreshing the apt package index on failure.
  • Add the same retry pattern to the squid Dockerfile.
  • Apply the retry pattern to the agent’s build-time compiler dependencies install used for building one-shot-token.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
containers/squid/Dockerfile Wraps apt-get install with a retry that clears apt lists and refreshes the index before re-attempting package installation.
containers/agent/Dockerfile Adds retry logic for base package installation and for installing build deps (gcc/libc6-dev) used to compile the one-shot-token shared library.
Comments suppressed due to low confidence (1)

containers/agent/Dockerfile:82

  • This retry block duplicates the gcc/libc6-dev package list and the apt-get sequence. Consider extracting a small helper pattern (or a variable for the package list) so future changes don’t have to be made in two places within the same RUN instruction.
    ( apt-get install -y --no-install-recommends gcc libc6-dev || \
      (rm -rf /var/lib/apt/lists/* && apt-get update && \
       apt-get install -y --no-install-recommends gcc libc6-dev) ) && \

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 13 to 15
(rm -rf /var/lib/apt/lists/* && apt-get update && \
apt-get install -y --no-install-recommends \
curl dnsutils net-tools netcat-openbsd openssl squid-openssl) ) && \
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package list is duplicated between the initial install and the retry install. This is easy to get out of sync over time (e.g., adding/removing a package requires updating two lists). Consider defining the package list once (e.g., a shell variable) and reusing it in both install attempts.

See below for a potential fix:

RUN set -eux; \
    PKGS="curl dnsutils net-tools netcat-openbsd openssl squid-openssl"; \
    apt-get update && \
    ( apt-get install -y --no-install-recommends $PKGS || \
      (rm -rf /var/lib/apt/lists/* && apt-get update && \
       apt-get install -y --no-install-recommends $PKGS) ) && \

Copilot uses AI. Check for mistakes.
Comment on lines 29 to 31
apt-get install -y --no-install-recommends \
iptables curl ca-certificates git gh gnupg dnsutils \
net-tools netcat-openbsd gosu libcap2-bin) ) && \
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry path repeats the full package list, which can drift from the primary install list above if it’s edited later. To avoid future inconsistencies, define the packages once (e.g., in a shell variable) and use that in both the initial install and the retry.

This issue also appears on line 80 of the same file.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot mentioned this pull request Feb 10, 2026
@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

Smoke Test Results - Claude Engine

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Fetched PRs successfully
  • ✅ Playwright: Navigated to GitHub, verified title "GitHub · Change is constant. GitHub keeps you ahead. · GitHub"
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-claude-21885952340.txt
  • ✅ Bash Tool: Verified file content successfully

Overall Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

Rust Build Test Results

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: PASS

All Rust projects built and tested successfully.

AI generated by Build Test Rust

@github-actions
Copy link
Contributor

Bun Build Test Results

Project Install Tests Status
elysia 1/1 PASS
hono 1/1 PASS

Overall: PASS

All Bun projects built and tested successfully.

AI generated by Build Test Bun

@github-actions
Copy link
Contributor

✅ Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests completed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects successfully downloaded dependencies and passed tests.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

Smoke Test Results (Copilot)

Test Results:

  • ✅ GitHub MCP: Retrieved 2 recent merged PRs
  • ✅ Playwright: Page title "GitHub · Change is constant. GitHub keeps you ahead. · GitHub" contains "GitHub"
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-copilot-21885952380.txt
  • ✅ Bash Tool: Successfully read file content back

Overall Status: PASS 🎉

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Merged PRs: fix: update testPathPattern to testPathPatterns for Jest 30; fix: use lowercase discussion categories to restore create_discussion tool
GitHub MCP merged PR review ✅
safeinputs-gh pr list ✅
Playwright title ✅
Tavily search ❌ (tool unavailable)
File write+cat ✅
Build npm ci && npm run build ✅
Discussion comment ✅
Overall: FAIL

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

.NET Build Test Results

Project Restore Build Run Status
hello-world PASS
json-parse PASS

Overall: PASS

All .NET projects successfully restored packages, built, and ran without errors.

AI generated by Build Test .NET

@github-actions
Copy link
Contributor

Java Build Test Results

Project Compile Tests Status
gson 1/1 PASS
caffeine 1/1 PASS

Overall: PASS

All Java projects compiled successfully and passed their tests through the firewall proxy.

AI generated by Build Test Java

@github-actions
Copy link
Contributor

Chroot Mode Version Comparison

Runtime Host Version Chroot Version Match?
Python 3.12.12 3.12.3 ❌ NO
Node.js v24.13.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall Result: ❌ Not all versions match

The chroot mode successfully accesses host binaries, but Python and Node.js show version mismatches. This indicates the container's built-in versions are being used instead of the host versions for those runtimes.

AI generated by Smoke Chroot

Address Copilot review feedback: define package lists once as shell
variables and reuse them in both the initial install and retry paths,
preventing the lists from drifting out of sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests passed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

Build Test: Bun - Results

Project Install Tests Status
elysia 1/1 PASS ✅
hono 1/1 PASS ✅

Overall: PASS ✅

All Bun projects built and tested successfully.

AI generated by Build Test Bun

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects successfully downloaded dependencies and passed their tests.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

Claude Smoke Test Results

Last 2 merged PRs:

Tests:

  • ✅ GitHub MCP (fetched PRs)
  • ✅ Playwright (title contains "GitHub")
  • ✅ File creation successful
  • ✅ Bash verification passed

Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

Build Test: Rust - Results

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: PASS

All Rust projects built and tested successfully.

AI generated by Build Test Rust

@github-actions
Copy link
Contributor

Node.js Build Test Results ✅

All projects tested successfully through the AWF firewall.

Project Install Tests Status
clsx PASS PASS
execa PASS PASS
p-limit PASS PASS

Overall: PASS

All three projects installed dependencies and passed their tests successfully.

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

Both projects successfully configured with CMake and built without errors.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

fix: update testPathPattern to testPathPatterns for Jest 30
fix: use lowercase discussion categories to restore create_discussion tool
GitHub MCP merged PR review ✅
safeinputs-gh pr list ✅
Playwright title check ✅
Tavily search ❌ (missing tool)
File write + cat ✅
Discussion comment ✅
Build npm ci && npm run build
Overall status: FAIL

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

Build Test: Java ✅

All Java build tests passed successfully!

Project Compile Tests Status
gson 1/1 PASS
caffeine 1/1 PASS

Overall: PASS


Test Details:

  • Repository cloned: Mossaka/gh-aw-firewall-test-java
  • Maven proxy configured with IP 172.30.0.10:3128
  • Both projects compiled and all tests passed without errors

AI generated by Build Test Java

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved PR data
  • ❌ Playwright: Timeout connecting to github.com
  • ✅ File Writing: Created test file successfully
  • ✅ Bash Tool: Verified file content

Overall Status: FAIL (Playwright timeout)

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Chroot Mode Test Results

Tested transparent host binary access through /host mount:

Runtime Host Version Chroot Version Match?
Python 3.12.12 3.12.3 ❌ NO
Node.js v24.13.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Status: Tests failed - Python and Node.js versions do not match between host and chroot environment.

AI generated by Smoke Chroot

@Mossaka Mossaka merged commit fde1331 into main Feb 10, 2026
93 checks passed
@Mossaka Mossaka deleted the fix/agent-dockerfile-apt-retry branch February 10, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant