Repository navigation
feat(host): refresh the default sandbox image and remove old ones - #89
Merged
kalaspuff merged 5 commits intoOct 18, 2026
Merged
Conversation
A host on the default image pulled its tag once, so its sessions' Claude Code aged between upgrades although the Image workflow rebuilds the image, and every upgrade left the previous version's image behind. The host now pulls its tag again when it starts and every 6 hours, unless the image there has no org.opencontainers.image.revision label, which only the Image workflow sets: then it was built on the host. A published build that a pull (or fctl host image build) replaces keeps a name, <tag>-replaced-<id>, and the host removes those, other versions' images and latest (once the version's image is here) without force, at start, after each pull and after sweeps that remove sandboxes. Docker keeps an image a sandbox uses until the sweep removes the sandbox; Apple's container gives each container its own copy of the image's filesystem. fctl host image pull removes them too and says what it removed, and fctl host doctor shows the image's Claude Code version, or that the host doesn't pull over a local build.
docs/sandbox-images.md says when the host pulls its tag again, how it tells a local build (the revision label), and which default images it removes, when, and why stopped sandboxes keep theirs with Docker but not with Apple's container. The architecture and CLI pages say so briefly.
Hosts now pull their tag again over, and remove, only images that carry org.opencontainers.image.revision, which only hyperstructure/sandbox's Image workflow sets, so that label is part of the interface between the two repositories.
Resolves the conflicts with #88. Its build tests and the image refresh's share one stand-in CLI, driver/fake.rs, which gains #88's builds, image sizes and failing builds; the two remove_image methods it and this branch added were the same, so one stays. docs/sandbox-images.md keeps #88's wording for project images, and says that a host on another image removes none of the default image's: it does remove old project builds.
kalaspuff
pushed a commit
to hyperstructure/sandbox
that referenced
this pull request
Oct 18, 2026
fctl hosts now pull their own version's tag again every 6 hours, so new sessions start from the newest build, with the newest Claude Code. They also remove the images sessions no longer start from: other versions' images, builds that a newer one replaced, and `latest` once their own version's image is there (hyperstructure/fctl#89, for hyperstructure/fctl#47). A host tells a published image from one built on the host by `org.opencontainers.image.revision`, which only the Image workflow sets (`docker buildx build --label …`). The `Dockerfile` sets no labels, and its base, `debian:bookworm-slim`, has none. A host never pulls over or removes an image without the label. So the label, and the `Dockerfile` not setting it, are now part of what fctl relies on: - AGENTS.md lists the label under "What fctl relies on", and its item on the tags says what hosts do with them now. - README.md's table of labels says that images built elsewhere have none. This is documentation only: the Image workflow doesn't run, and the image doesn't change. Refs hyperstructure/fctl#47 Session: https://app.fctl.sh/s/ses_01M5813Y3P1VY7K0ZSS6PKRS9V Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff
deleted the
fctl/43-can-you-look-into-https-github-com-hyper
branch
October 18, 2026 18:46
2 tasks done
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.
Hosts on the default sandbox image pulled their tag once and kept it. hyperstructure/sandbox's Image workflow rebuilds the newest release's image when Claude Code has a newer release, since fctl turns off Claude Code's auto-updater. But a host that already had the tag kept its first pull until it was upgraded or someone ran
fctl host image pull, so its sessions' Claude Code aged between upgrades anyway. And every upgrade left the previous version's image on the host, as did thelatesta host pulls while its release's image isn't published yet. Nothing removed them.The two decisions #47 left to a person were made in this session, and are recorded in the issue. The host tells a local build from the published image by the
org.opencontainers.image.revisionlabel, which only the Image workflow sets. It pulls again at start and every 6 hours.What changed
Refreshing (
crates/fctl-host/src/refresh.rs,daemon.rs). The host's background pull used to run once, at start, and only for a missing image. Now it runs at start and every 6 hours:latestwhile the version's image can't be pulled.fctl host image buildor by hand: the sandbox'sDockerfilesets no labels, and its base,debian:bookworm-slim, has none. An image whose description can't be read counts as a local build, so the host leaves it alone, as it did before.host.tomlsets another image pulls it only when it isn't there, as before.Removing (
refresh::clean_up). At start, after each pull and after sweeps that remove sandboxes, the host removes these, without force:X.Y.Ztags);latest, once the version's image is here. Until then, sessions start from it.Images without the revision label stay, and so do tags hosts don't pull, like
0.5, which projects may use. A host on another image removes nothing.How a replaced build stays findable. A pull that moves a tag leaves the old build without a name. Docker keeps it as
<none>, and with the containerd image store nothing finds that again by name. Apple'scontainerkeeps its blobs and snapshot orphaned until animage deleteruns its cleanup. So before a pull (orfctl host image build) replaces a published build, the host gives that build a second name,<tag>-replaced-<the start of its ID>, and removes the name right after:keep_stopped_hours).This needs no state file, and a host that stops halfway leaves a name the cleanup finds. A name whose build is still the one sessions start from is left alone, so a cleanup that runs during a pull can't strand the build.
Apple.
container image deletedoesn't check whether a container uses the image. It's still safe: each container gets a clone of the image's filesystem when it is created (Bundle.cloneContainerRootFsin apple/container), and starting it again uses only that clone. So on Apple the host removes these right away, and stopped sandboxes still start.Driver (
driver/container.rs,driver/mod.rs):image: ID and labels fromimage inspect, in Docker's, Podman's and both of Apple's shapes (its JSON changed at 1.0).tag_image.remove_image:image rmorimage delete, never forced.images:image ls --format …orimage list --quiet.CLI (
crates/fctl/src/cmd/host.rs):fctl host image pullalso removes what sessions no longer start from, and says what it did:--jsonaddsnewer(whether the pull brought a newer build) andremoved(the names it removed) toimageandinstead_of.fctl host doctorshows the image's Claude Code version, or that the host doesn't pull over a local build:Docs:
docs/sandbox-images.mdsays when the host pulls again, how it tells a local build, and what it removes and when, with Docker and with Apple.docs/architecture.mdanddocs/cli.mdsay the same briefly.Tests. The driver tests' stand-in for the
dockerandcontainerCLIs moved todriver/fake.rs, shared by the driver tests, these tests and #88's build tests. It gained image IDs, labels, tags, listing, and Docker's refusal to remove an image's last name while a container uses it. It keeps #88's builds, image sizes and failing builds.With #88.
maingained #88 (projects' own images and builds) while this was open, and is merged in. Both added the sameremove_imageto the driver, so one stays. Project images and builds aren't the default image, so the host doesn't pull them again here or remove them in this cleanup: #88 keeps each project's newest build itself.Compatibility
This changes only the host: no protocol or control-plane change, and it reaches hosts with the next release.
fctl host image pull --jsongains two fields.<none>stay: nothing tells them from other unnamed images.Verification
Unit tests: 14 new; fctl-host has 57 with feat: let hosts allow and build projects' sandbox images #88's.
removable: what goes and what stays, includinglatestbefore and after the version's image arrives, local builds,X.Ytags, and a replaced name whose build is still current.fctl host image pulldoes;latestgoing once the version's image is published;The published image (read from ghcr.io anonymously): the config of
ghcr.io/hyperstructure/sandbox:0.5.0hasorg.opencontainers.image.revision(12685ad…) andsh.fctl.claude-code.version(2.1.302).debian:bookworm-slim, the base of local builds, has no labels.With real Podman (rootless,
FCTL_DOCKER_BIN=podman): I imported images of a few KB under the default image's names. The host's0.5.0was a local build, and a stoppedfctl-ses-…container used0.3.0.fctl host run:0.4.0(only untagged, since0.4names the same build),latest, and a0.5.0-replaced-…build;0.3.0because Podman refused ("image is in use by a container"), and kept the local0.2.0and the0.4tag.fctl host doctorsaid "built here: the host doesn't pull over it".With the stand-in CLI (
FCTL_DOCKER_BIN), the real binary:fctl host image pullprinted the output above.fctl host image pull --jsonprinted{"image": "ghcr.io/hyperstructure/sandbox:0.5.0", "instead_of": null, "newer": false, "removed": ["ghcr.io/hyperstructure/sandbox:0.5.0-replaced-0a1d00000000"]}.fctl host runloggedpulled a newer build of ghcr.io/hyperstructure/sandbox:0.5.0 (Claude Code 2.1.310), kept the replaced build while a sandbox used it, and removed0.4.0.doctorshowed the Claude Code version.cargo xtask check --quickpasses, before and after mergingmain. I reran the Podman check on the merged binary, with the same result.Not run here: Docker itself (this sandbox can't run a Docker daemon) and Apple's
container(that needs a Mac). The commands are the documented ones. I read the behaviors this relies on in their sources:moby-dangling@…records as that same name (daemon/images/image_delete.go,daemon/containerd/image_delete.go).image deletecleans up, andimage tagoverwrites an existing name.Trying the first release on a Docker host and on a Mac is the check that's left.
Fixes #47
Session: https://app.fctl.sh/s/ses_01M5813Y3P1VY7K0ZSS6PKRS9V