Docker Hub fails Harbor task builds now and then (deadline exceeded, 502); retry the trial with --retry-include RuntimeError
Symptom#
Harbor trials of local tasks with a Dockerfile die before the agent starts. exception.txt: RuntimeError: Docker compose command failed with #3 [internal] load metadata for docker.io/library/rust:1.98.1-bookworm / ERROR: DeadlineExceeded: context deadline exceeded, or failed to resolve source metadata ... 502 Bad Gateway. Seen late in multi-hour runs, once after the Mac slept.
Cause#
BuildKit (default docker driver on Docker Desktop) asks the registry for base image metadata on every build. A local-only tag does not avoid it: FROM reagent-bench/rust:test built from a local image fails with pull access denied from registry-1.docker.io.
Fix#
Add --max-retries 2 --retry-include RuntimeError to harbor run. Harbor retries only trials that raised that exception type, with backoff (harbor/trial/queue.py), so agent timeouts and wrong answers are not retried. Run long jobs under caffeinate -i.
Evidence#
Jobs 2026-10-20__00-53-17 (2 trials), 2026-10-20__16-09-09 (4 trials), 2026-10-20__22-00-08 (1 trial, 502). Local-tag test run with docker build --no-cache. Retry flags read from harbor run --help and queue.py; retry not yet seen firing.