Repository navigation
fix: split the image into layers of at most 200 MB - #17
Merged
kalaspuff merged 4 commits intoNov 26, 2026
Merged
Conversation
ghcr.io sends each layer's download to a signed link that expires within 5 to 10 minutes, and closes the connection then. The image was one 1.33 GB layer, which an Apple runner pulling at 2.4 MB/s never finished: each try broke off after about 10 minutes, and Apple's container keeps nothing of a pull that broke off, so the host's retries started over each time. provision.sh now runs in steps, which the Dockerfile runs in a RUN each; without arguments it runs them all, as fctl's Lima driver does. apt's lists are fetched once per run and removed as it ends. Pull requests' Image runs list what hosts download and the largest layer, and warn about layers over 200 MB.
On amd64 the compiler, cargo and the host's standard library made a 222 MB layer. The Image workflow's warning now names each layer over 200 MB.
kalaspuff
approved these changes
Nov 26, 2026
kalaspuff
deleted the
fctl/1679-the-host-seems-to-have-failed-downloadin
branch
November 26, 2026 20:37
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.
Summary
An Apple runner couldn't pull
ghcr.io/hyperstructure/sandbox:0.38.1: each of the host's three tries broke off after about 10 minutes withStreamClosed … ProtocolError. ghcr.io sends each layer's download to a signed link that expires within 5 to 10 minutes (the next 5-minute mark plus 5 minutes), and its CDN resets the HTTP/2 stream at that moment: a throttled curl of the layer from an fctl sandbox was cut 8 s after its link expired, with the same error. The image was a single 1.33 GB layer (1.40 GB on amd64), which takes longer than that at 2.4 MB/s, and Apple'scontainerkeeps nothing of a pull that broke off, so every retry started over and hit the same limit.provision.shnow runs in named steps (STEPS), and the Dockerfile runs each in aRUNof its own, so the image comes in 17 layers instead of 4. Run without arguments, as fctl's Lima driver runs it, the script still does every step in order. apt's lists are fetched once per run and removed as it ends, so no layer keeps them. Rust's compiler and its standard library come in separate steps: together they made a 222 MB layer on amd64. The Lint workflow checks that the Dockerfile runs every step. On pull requests, the Image workflow lists each layer's size and what hosts download, and warns about a layer over 200 MB. AGENTS.md and the change-the-image skill say how to keep layers under that.What hosts download barely changes; the only new bytes are the few files each apt step rewrites (dpkg's status, debconf's templates, logs). Measured from this pull request's Image run against the published 0.38.1 image:
Both builds pass
check.sh, and the Develop fctl workflow builds and tests fctl in each.Worth confirming
Rangerequests (Resume blob downloads after a dropped connection apple/containerization#949, not merged) fixes that.ruststep removes the host's standard library that rustup's minimal profile installs, andrust-stdadds it back with wasm32's. The Lima driver, which runs every step at once, downloads it twice.fctl session
Note
Medium risk. It restructures how the image every fctl session runs in is built, splitting
provision.shinto steps and the Dockerfile into one layer per step, so a missed install detail would break all sessions, though CI builds and checks the image.What it does. Splits
provision.shinto namedstep_functions that run in order, or only those named as arguments, and makes the Dockerfile run each step in its ownRUN, so that no layer is over about 200 MB compressed and downloads finish before ghcr.io's expiring links cut them off. The Rust install is split in two:rustinstalls the compiler, cargo, rustfmt and Clippy and removes the host standard library, andrust-stdadds it back with wasm32's. The Image workflow lists each layer's size and warns about any over 200 MB, and Lint now checks that the Dockerfile runs every step ofSTEPSin order.Steps listed in two places. A new step goes in
STEPSinprovision.shand as aRUNin the Dockerfile; the Lima driver runs the script without arguments, so a step missing from the Dockerfile would be left out of the Docker image, which the new Lint check now catches.fctl review's first look at
2cc0bd1· 6 files, +263 −104 · Review agent settings