Skip to content

fix(host): treat a container CLI that can't start as an error - #107

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/51-runtime-cli-start-errors
Oct 19, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/51-runtime-cli-start-errors

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The container driver read every failed command other than a timeout as "not there". When the docker or container CLI itself couldn't start (missing, not executable, or "Text file busy" as in #100), that meant:

  • image() said the image wasn't here, so refresh went on to pull it or latest. This is the second item of A host test fails at random when the fake CLI's script is busy #100, and what made the_host_leaves_a_current_build_as_it_is pull on CI.
  • state() said the sandbox didn't exist, so stop() and remove() returned without doing anything. A sweep then logged "removed fctl-ses-…" and forgot when the sandbox stopped, while it was still there.
  • Creating a sandbox logged "Pulling …", tried latest, and failed with "… is not on this host and can't be pulled".
  • fctl host image pull said the image "can't be pulled, and neither can" latest.

What changed

Spawn errors are now a type of their own, NotStarted (crates/fctl-host/src/driver/mod.rs), with the same messages as before. unanswered(e) says whether a failure leaves the question open: the command couldn't start, or ran out of time. image(), state() and create() now pass both on as errors, as they already did timeouts, and pull_or_fallback() doesn't fall back when the CLI couldn't start. The host now reports, for instance, running docker: Permission denied (os error 13).

Two places still read any failure as "not here":

  • has_image() stays a bool. Where a failure leads somewhere (creating a sandbox, falling back to latest), the code checks the failed command's own error first.
  • vm_disk_free_mb() still tries the next image after any failure. Whichever image runs df measures the same disk, so a CLI that fails to start once costs nothing there.

The Lima driver ignores every error from limactl stop and delete, which is a question of its own.

docs/architecture.md now says what the host does with a command that can't start, next to commands that hang.

How I verified it

  • A new test, nothing_is_missing_when_the_cli_cannot_start, takes away the stand-in CLI's execute permission and checks image, exists, stop, remove, ensure, create and pull_or_fallback. Each fails with the start error, and nothing is pulled or logged as a fallback. Undoing any one of the four changes makes it fail.
  • The driver's own tests check that a missing program and a timeout leave the question open, and a command that ran and failed doesn't.
  • cargo xtask check --quick passes, and none of 200 runs of fctl-host's tests failed.

Compatibility

Host only, no protocol change: it ships with the next release.

Fixes #100

Session: https://app.fctl.sh/s/ses_01M5AFQJTX6FENQJJZWRD5AP5K

The container driver read every failure other than a timeout as "not
there": an image that `image inspect` couldn't look at was missing, and a
sandbox that `inspect` couldn't look at was gone. When the CLI itself
couldn't start (missing, not executable, "Text file busy"), the host
pulled images it had, fell back to `latest`, and took sandboxes it
couldn't stop or remove for stopped and removed.

Spawn errors are now a type of their own, NotStarted, with the messages
they had. image(), state() (exists, ensure, stop, remove), create() and
pull_or_fallback() pass them on instead of reading them as absence.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 19, 2026 19:32
@kalaspuff
kalaspuff merged commit 3f6e9c3 into main Oct 19, 2026
5 checks passed
@kalaspuff
kalaspuff deleted the fctl/51-runtime-cli-start-errors branch October 19, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

A host test fails at random when the fake CLI's script is busy

1 participant