From d37320f0805a6edec26a0926ac5affe8f492a975 Mon Sep 17 00:00:00 2001 From: Hai Huang Date: Fri, 4 Sep 2026 10:34:51 -0400 Subject: [PATCH] fix: Refuse to drive binaries older than the installer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported from a real run: warning: v0.7.0-alpha.3 has no authbridge/install.sh (HTTP 404); continuing with the copy from main ... warning: Cortex exited during startup — last log lines: flag provided but not defined: -local The bootstrap I added prevents running an unreleased SCRIPT, but the fallback path reintroduces the mismatch from the other side: when the resolved release has no installer, the script comes from main while the BINARIES still come from that older release. A newer script then passes flags an older binary never had, and the run dies deep in startup with a message that reads like a bug in Cortex rather than a version mismatch. It is not one flag. v0.7.0-alpha.3's abctl has no subcommand dispatch at all, so `claude-code` and `tools scan` are absent too — that script cannot drive those binaries at all, and no installer can give --claude-code from that release because the feature is not in it. So the script now probes for `--local` before using the binaries and stops with an explanation. Probing the flag beats comparing version strings: the flags are the actual contract, and a probe needs no updating when the scheme changes. `--local` arrived in the same change as abctl's subcommands, so it stands in for all of them. The message deliberately does not suggest --ref=: a release old enough to fail the probe has no authbridge/install.sh either, so the bootstrap would 404, fall back to main, and land back on the same error. I suggested that first and it was circular. It names the two things that do work — a newer release, or that release's own installer under its old name — and I verified the latter installs. This makes the failure legible; the fix is a release whose binaries match, which is the next tag. Assisted-By: Claude (Anthropic AI) Signed-off-by: Hai Huang --- authbridge/install.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/authbridge/install.sh b/authbridge/install.sh index 6806b3d6..42c3f7f8 100755 --- a/authbridge/install.sh +++ b/authbridge/install.sh @@ -440,6 +440,34 @@ rm -rf "$tmp" trap - EXIT fi # end of download block +# --- refuse to drive binaries older than this script --- +# +# The script and the binaries can come from different releases: when the resolved +# release has no authbridge/install.sh the bootstrap falls back to the copy from +# main, but the BINARIES still come from that older release. A newer script then +# passes flags and subcommands the older binaries never had, and the run dies +# deep in startup with "flag provided but not defined: -local" — which reads like +# a bug in Cortex rather than a version mismatch. +# +# Probing the flag beats comparing version strings: the flags are the actual +# contract, and a probe needs no updating when the scheme changes. `--local` +# arrived in the same change as abctl's `claude-code` and `tools scan` +# subcommands, so it stands in for all of them. +if ! "${BIN_DIR}/authbridge-proxy" --help 2>&1 | grep -q -- '-local'; then + # Deliberately not suggesting --ref=${version}: a release old enough to fail + # this probe is old enough that its tree has no authbridge/install.sh either, + # so the bootstrap would 404, fall back to main, and land right back here. + die "the ${version} binaries are older than this installer. + They have no --local (it was --demo then), and their abctl has no claude-code + or tools subcommands, so this script cannot drive them — and no installer can + give you --claude-code from ${version}, because the feature is not in it. + Either: + wait for a release newer than ${version}, or set + AUTHBRIDGE_VERSION= to install newer binaries with this script; + or run that release's own installer, which matches its binaries: + curl -fsSL https://raw.githubusercontent.com/${REPO}/${version}/authbridge/install-demo.sh | sh" +fi + # --- report --- proxy="${BIN_DIR}/authbridge-proxy" ca_dir="${CORTEX_DIR}/ca" # matches defaultCortexDir()+caDirName in local.go