Skip to content

fix(update): compare the running image version, not just the git tag - #442

Merged
CheeryProgrammer merged 1 commit into
mainfrom
fix/updater-image-check
Jul 21, 2026
Merged

fix(update): compare the running image version, not just the git tag#442
CheeryProgrammer merged 1 commit into
mainfrom
fix/updater-image-check

Conversation

@CheeryProgrammer

Copy link
Copy Markdown
Contributor

Problem

./brainiac update's "already up to date" check compared only the tag at HEAD (git describe --tags --exact-match) to the newest tag:

if [ "$current" = "$latest" ]; then echo "already up to date"; exit 0; fi

This assumes git tag at HEAD == running image, which breaks for a from-source build (or any checkout left sitting on the latest tag while the running image is older/different). Observed live: after tagging a release on the checked-out commit while the stack ran a local from-source build, update said "already up to date (v1.118.0)" and skipped the image pull — leaving the running container on the local build, not the released image.

Fix

Also compare the running app's reported version, and only short-circuit when both the checkout and the running image are on the latest tag:

running="$(docker compose exec -T app /brainiac version 2>/dev/null | awk '{print $NF}' || true)"
if [ "$current" = "$latest" ] && [ "${running#v}" = "${latest#v}" ]; then
    echo "update: already up to date ($latest)."; exit 0
fi

If the container is down or reports a different version, it proceeds to pull — the correct behaviour. v-prefix normalized on both sides.

Verification

  • sh -n brainiac clean (POSIX).
  • Against the live stack (running a 0.0.0-docker from-source build, latest tag v1.118.0): the new check evaluates "0.0.0-docker" != "1.118.0"mismatch → would pull (old behaviour: false "up to date").

Docs: SYSTEM.md decision-log entry.


🤖 Generated with Claude Code

`brainiac update`'s "already up to date" check compared only the tag at
HEAD (`git describe --exact-match`) to the newest tag. A from-source
build — or any checkout left sitting on the latest tag while running an
older/different image — was wrongly reported up to date and the prebuilt
image pull was skipped (observed after tagging a release on the checked-
out commit while running a local build).

Also compare the app's reported version (`/brainiac version`) and only
short-circuit when both the checkout AND the running image are on the
latest tag; otherwise proceed to pull. POSIX sh; `sh -n` clean.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CheeryProgrammer
CheeryProgrammer merged commit 60b7996 into main Jul 21, 2026
5 checks passed
@CheeryProgrammer
CheeryProgrammer deleted the fix/updater-image-check branch July 21, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant