Skip to content

ci(beta): rebuild a broken ASC venv instead of failing - #923

Merged
javierbq merged 1 commit into
masterfrom
ci/beta-venv-self-heal
Nov 3, 2026
Merged

javierbq merged 1 commit into
masterfrom
ci/beta-venv-self-heal

Conversation

@javierbq

@javierbq javierbq commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Why

The nightly Beta (self-hosted, puma) run failed every night from Oct 28 to Nov 2 at "Python venv for the ASC client" with:

Error: [Errno 2] No such file or directory: '/Users/javier/.raymol-beta-venv/bin/python3'

~/.raymol-beta-venv was first built Oct 14 with Homebrew Python 3.14. After that, every run re-ran python3 -m venv with Xcode's 3.9 over the existing venv. That left a mixed venv: a 3.9 pyvenv.cfg, with bin/python3 -> python3.14 -> /opt/homebrew/opt/python@3.14/bin/python3.14. The venv broke as soon as Homebrew's opt link went missing. Homebrew relinked it Nov 2, so the step runs again for now, but the next Homebrew upgrade or cleanup would break it the same way.

What

  • The interpreter is pinned to /usr/bin/python3, which is what python3 already resolves to on the runner PATH (Xcode 3.9.6).
  • The step reuses the venv only if bin/python runs and reports that interpreter's sys.base_prefix. Otherwise it rebuilds the venv with python3 -m venv --clear. A dangling link, a missing venv, or a venv on another Python all lead to a clean rebuild, so the venv can't end up mixed again.
  • pip now runs as "$VENV/bin/python" -m pip. The old bin/pip call went through an absolute shebang (#!…/bin/python3.14) that fails the same way when its target dies.
  • docs/ci/selfhosted-beta-runner.md gains a bullet on how the venv heals itself.

On the first run after merge, the step will rebuild the real venv once, because it is currently on Homebrew 3.14. After that it stays on the happy path.

Testing

I did not dispatch the Beta workflow, and ~/actions-runner and the real venv were not touched. I pulled the step's run: block out of the YAML with Ruby's YAML parser and ran it under env -i with HOME set to a temp dir and the runner's PATH:

Case Result
Copy of the real mixed venv (3.9 cfg, bin → Homebrew 3.14) Detected "on another Python", rebuilt on 3.9.6, exit 0
Copy with dangling bin/python3.14 (bin/python3 fails with rc 127) Detected, rebuilt, exit 0
No venv Built, exit 0
Re-run on the healed venv (happy path) No rebuild, exit 0, about 0.3 s

In every case the venv then imports jwt 2.15.1 and cryptography 50.0.2 on Xcode 3.9.6. With the rebuilt 3.9 venv:

  • scripts/asc_next_build_number.py ran end to end. It signed the JWT and made a read-only ASC GET, which printed 375.
  • scripts/asc_wait_build_valid.py --help and scripts/xcode_cloud_beta_workflows.py both load.

All scripts/asc_*.py files parse with feature_version=(3,9) and use no syntax newer than 3.9. Afterwards the real ~/.raymol-beta-venv was unchanged.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@javierbq
javierbq merged commit fe7b1bb into master Nov 3, 2026
7 checks passed
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