Skip to content

fix(compose): pull the images in install.sh, so a cached :latest cannot run - #664

Merged
cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/349-compose-install-pull
Oct 29, 2026
Merged

cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/349-compose-install-pull

Conversation

@cwiklik

@cwiklik cwiklik commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Summary

docker compose up -d pulls an image only when no local image matches the reference, so a :latest the machine already has — pulled once, weeks ago — is never re-resolved against the registry. install.sh had no pull step, so a re-run of the README's curl … | sh one-liner silently brought the stack up on whatever was cached, with every container reporting Started.

In the reported case the cached image predated packages/supervisor existing, so the supervisor crash-looped on ERR_MODULE_NOT_FOUND: Cannot find package 'tsx' and /turn reset the connection. Nothing in the install output hinted the image was stale.

This takes fix (a) from the issue: install.sh pulls, every run.

What changed

A pull_images step in main, between ensure_control_plane_profile and ensure_mu1_secrets. Three properties, each pinned by a test:

Property Why
Runs from the project directory so the references pulled are the ones .env interpolates (SH_HARNESS_IMAGE, SH_SANDBOX_IMAGE), not the file's defaults
Runs before up -d the whole point — otherwise up resolves the cached image first
Runs before the key generator ensure_mu1_secrets runs genkeys.ts inside the harness image. A stale image may ship a different generator, or — as in this issue — not the package at all

A failed pull is fatal, not a warning: running whatever images the machine happens to hold is the bug, and on a first install there is nothing to fall back to. The refusal names the override. SH_SKIP_PULL=1 skips the pull entirely (not attempted, so an offline host waits for no timeout) and starts the stack on the local images — for an offline host, or an SH_HARNESS_IMAGE built from a checkout that no registry serves.

The pull goes through $COMPOSE, so a machine without the v2 plugin pulls with docker-compose too.

Verification

Against the issue's acceptance criteria:

  • install.sh pulls before starting the stack, on a fresh machine and on a re-run
  • tests/install.test.sh asserts the pull happens, and that it happens before up
  • the README one-liner always gets current main without a manual docker compose pull
Check Result
deploy/compose/tests/install.test.sh 27 oks, exit 0 (was 22)
Negative test — pristine install.sh exit 1 at exactly install.sh did not pull before starting the stack, so a stale cached :latest runs (#349)
Negative test — pull made non-fatal (|| true) exit 1 at install succeeded with a failing pull
Negative test — pull_images moved after ensure_mu1_secrets exit 1 at the key generator ran before the pull, so it ran in a possibly stale image (#349)
install.test.sh under /bin/bash 3.2.57 (#440) exit 0, 27 oks
compose.test.sh, images.test.sh exit 0
make test-deploy 438 oks; only deploy/microvm/tests/build-snapshot.test.sh fails — pre-existing on macOS (needs microVM build tooling), untouched by this diff, passes in CI on ubuntu
shellcheck -x -S warning, sh -n, bash -n clean
prettier, check-doc-links.py (212 files, 0 broken) clean

Daemon-free cross-check of what the pull covers: docker compose config --images resolves ghcr.io/rossoctl/moca:latest, ghcr.io/rossoctl/moca-remote-worker:latest and docker.io/redis:7-alpine — the harness image (the key generator's) is in the set with or without the control-plane profile. A live pull could not be exercised here (no Docker daemon on this machine); the mocked suite covers the argv, ordering, failure and skip paths.

Docs

  • deploy/compose/README.md: the pull as step 3 of "Try it" (with why up -d alone isn't enough), SH_SKIP_PULL in the SH_HARNESS_IMAGE row, the pull in "Upgrading", and the new assertions in "Tests".
  • docs/reference/configuration.md: SH_SKIP_PULL under the compose installer's inputs.

Related: #342 (compose trial), #345. The sibling report for the VM path is #414 (setup-vm.sh never pulls either) — not touched here.

Fixes #349

Assisted-By: Claude Code

…ot run

`docker compose up -d` pulls an image only when no local image matches the
reference, so a :latest the machine already has -- pulled once, weeks ago --
is never re-resolved against the registry. install.sh had no pull step, so a
re-run of the README's one-liner silently brought the stack up on whatever was
cached. In the reported case that image predated packages/supervisor existing,
and the supervisor crash-looped on ERR_MODULE_NOT_FOUND with nothing in the
install output hinting the image was stale.

Pull explicitly before `up -d`, from the project directory so the references
pulled are the ones .env interpolates, and before the control plane's key
generator, which is code from the harness image itself. A failed pull is fatal:
running the images this machine happens to hold is the bug, and on a first
install there is nothing to fall back to. SH_SKIP_PULL is the way past it for
an offline host or a locally built SH_HARNESS_IMAGE.

Fixes rossoctl#349

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@cwiklik
cwiklik requested a review from pdettori as a code owner October 29, 2026 16:49
@cwiklik cwiklik added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 29, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #349 cleanly: pull_images runs $COMPOSE pull from the project directory (so .env-interpolated SH_HARNESS_IMAGE/SH_SANDBOX_IMAGE are what get pulled), before both the key generator and up -d, fail-closed with SH_SKIP_PULL as the documented escape hatch. Tests pin ordering, the docker-compose fallback, the failure path and the skip path; docs updated.

Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell, Docs, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing

One nit inline.

# The generator is code from the harness image, so it has to run on the PULLED one (#349): a stale
# image may ship a different genkeys.ts, or -- as in the issue -- not the package at all.
genkeys_at="$(log_line_of '^docker run .*genkeys\.ts')"
[[ -n "$genkeys_at" && "$(log_line_of '^docker compose pull ')" -lt "$genkeys_at" ]] ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this ordering check is vacuous when the pull is missing — log_line_of returns empty and bash [[ "" -lt N ]] treats the empty operand as 0, so it passes. Mirror the guard used for pull_at/up_at above:

pull_at="$(log_line_of '^docker compose pull ')"
[[ -n "$pull_at" && -n "$genkeys_at" && "$pull_at" -lt "$genkeys_at" ]] ||

@cwiklik
cwiklik merged commit 17de290 into rossoctl:main Oct 29, 2026
22 of 23 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 2, 2026
Takes upstream's 11 commits after 071b213: gh vendored into the sandbox images (rossoctl#661), the sandbox image pulled on every run in both VM paths (rossoctl#665) and in compose (rossoctl#664), a cached login matched by endpoint (rossoctl#667), a kind-ci fix (rossoctl#663). No conflicts.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy/compose: install.sh doesn't pull, so a locally cached :latest can run a stale image (supervisor crash loop)

2 participants