From c3b33bdefb6106c4fb7fd901369dae3fcf1b95ef Mon Sep 17 00:00:00 2001 From: Javier Castellanos Date: Mon, 2 Nov 2026 17:28:34 -0800 Subject: [PATCH] ci(beta): rebuild a broken ASC venv instead of failing The nightly self-hosted Beta failed Oct 28 - Nov 2 at its venv step with "No such file or directory: ~/.raymol-beta-venv/bin/python3". The venv was first built with Homebrew Python 3.14. Each run then re-ran `python3 -m venv` (Xcode 3.9) over it, which left a mixed venv: a 3.9 pyvenv.cfg with bin/python3 pointing at Homebrew 3.14. The venv broke as soon as Homebrew's python@3.14 opt link went missing. The step now pins the interpreter to /usr/bin/python3. It reuses the venv only if bin/python runs and reports that interpreter's base_prefix. Otherwise it rebuilds the venv from scratch with `venv --clear`. pip runs as `python -m pip`, so a stale absolute shebang in bin/pip can't hit a dead interpreter. The runner doc describes the behaviour. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/beta-selfhosted.yml | 17 +++++++++++++++-- docs/ci/selfhosted-beta-runner.md | 7 +++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/beta-selfhosted.yml b/.github/workflows/beta-selfhosted.yml index 27eb1fb1e..0b9b344ca 100644 --- a/.github/workflows/beta-selfhosted.yml +++ b/.github/workflows/beta-selfhosted.yml @@ -72,10 +72,23 @@ jobs: - name: Python venv for the ASC client (idempotent) if: steps.skip.outputs.skip != 'true' + # The venv is built only by this one pinned interpreter (Xcode's 3.9, + # what python3 resolves to on the runner PATH) and only from scratch + # (--clear). Re-running `venv` over an existing venv made by another + # Python leaves a mix (3.9 pyvenv.cfg, bin/python3 -> Homebrew 3.14) + # that dies when Homebrew moves its opt link. So: reuse the venv only + # if it runs and is on the pinned interpreter, else rebuild it. run: | set -euo pipefail - python3 -m venv "$HOME/.raymol-beta-venv" - "$HOME/.raymol-beta-venv/bin/pip" install -q --disable-pip-version-check PyJWT cryptography + PY=/usr/bin/python3 + VENV="$HOME/.raymol-beta-venv" + want="$("$PY" -c 'import sys; print(sys.base_prefix)')" + have="$("$VENV/bin/python" -c 'import sys; print(sys.base_prefix)' 2>/dev/null || true)" + if [ "$have" != "$want" ]; then + echo "venv at $VENV is missing, broken or on another Python (${have:-none}); rebuilding with $PY ($want)" + "$PY" -m venv --clear "$VENV" + fi + "$VENV/bin/python" -m pip install -q --disable-pip-version-check PyJWT cryptography - name: Next build number (max in App Store Connect + 1) id: num diff --git a/docs/ci/selfhosted-beta-runner.md b/docs/ci/selfhosted-beta-runner.md index 7f4259a48..55ad441e1 100644 --- a/docs/ci/selfhosted-beta-runner.md +++ b/docs/ci/selfhosted-beta-runner.md @@ -100,6 +100,13 @@ The `Keep logs` step uploads the full `archive.log`, `export.log` and - **Side effects on puma:** `ci_post_clone.sh` runs `brew install` on a fixed set of packages and turns off Xcode's plugin/macro fingerprint validation through `defaults`. That setting also affects interactive Xcode use on puma. +- **The ASC client venv heals itself.** `~/.raymol-beta-venv` (PyJWT + + cryptography for the `asc_*.py` scripts) is always built by + `/usr/bin/python3`, Xcode's 3.9. Each run reuses it only if + `bin/python` starts and reports that same interpreter. Otherwise the run + rebuilds it with `venv --clear`. A Homebrew upgrade or an Xcode move + therefore costs one rebuild and no failed night. Never build this venv by + hand with another Python. If you do, the next run rebuilds it anyway. ## Troubleshooting