fix(docker): retry the HuggingFace prewarm fetch instead of failing the build - #338
Merged
Conversation
…he build Both image builds pre-cache the embedding model with a single-shot network fetch. A transient huggingface.co blip therefore fails the build outright: CI run 30749502167 (PR #337, 2026-08-02) died on "We couldn't connect to 'https://huggingface.co'" after 73s, on a commit whose diff touched neither Dockerfile nor any of their dependencies. Re-running the same job with no code change passed — the fetch, not the change, decided the outcome. ci.yml already solved this in four places (attempts + backoff + loud failure). The Dockerfiles were the paths that never got it. This mirrors that idiom verbatim, constants included, and cites it as the source. The devcontainer image gets the same treatment for its FlashRank prewarm: failing loudly after the retries is deliberate there, since a silently unprewarmed image reproduces the 2026-07-11 silent-reranker incident one layer up. No BuildKit cache mount: the runtime stage COPYs the HF cache out of the builder layer, and a cache mount is not part of the layer. scripts/setup.sh performs the same fetch but is deliberately left alone — it already degrades to "will download on first use" instead of failing, so retries would buy no correctness and cost up to 100s of silent wait in an interactive installer. Verified: both RUN bodies joined the way Docker joins continuations parse under `sh -n`; all three `python -c` payloads compile; the retry helper returns 0 on the success path and propagates non-zero after exhausting attempts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Le défaut
docker/Dockerfileet.devcontainer/Dockerfilepré-cachent le modèle d'embedding avec un fetch réseau single-shot. Un blip transitoire dehuggingface.cofait donc échouer le build entier.Ce n'est pas hypothétique — c'est arrivé aujourd'hui :
CI run
30749502167, sur la PR #337, dont la diff ne touchait ni ce Dockerfile ni aucune de ses dépendances. Le même job passait sur le commit parent, et un re-run sans changement de code est repassé vert. C'est le fetch qui décidait de l'issue du build, pas le contenu de la PR.Le correctif
ci.ymlavait déjà résolu ce problème à quatre endroits (5 tentatives, backoffattempt*10s, échec bruyant). Les Dockerfiles sont les seuls chemins qui ne l'avaient jamais reçu. Ce commit y porte l'idiome à l'identique, constantes comprises, avec# source:pointant versci.yml.Le prewarm FlashRank du devcontainer reçoit le même traitement. L'échec bruyant après épuisement des tentatives y est délibéré : une image silencieusement non-préchauffée, c'est l'incident du 2026-07-11 (re-ranker absent en silence, 6 benchmarks invalidés) reproduit une couche plus haut.
Choix explicites
COPY --from=builder /root/.cache/huggingface— un cache mount ne fait pas partie du layer, l'image sortirait sans modèle.scripts/setup.shvolontairement non modifié. Il fait le même fetch, mais dégrade déjà en « will download on first use » au lieu d'échouer. Y ajouter des retries n'achèterait aucune correction et coûterait jusqu'à 100 s d'attente silencieuse dans un installeur interactif.Vérification
RUN, joints comme Docker joint les continuations (sans newline), passentsh -n.python -ccompilent (compile(..., "exec")).retryretourne 0 sur le chemin succès et propage un code non nul après épuisement — les deux chemins exécutés.🤖 Generated with Claude Code