From 0754d59999d7c79f4867bfc27dbbee23b938d8a8 Mon Sep 17 00:00:00 2001 From: Omar Abdelwahab Date: Wed, 12 Nov 2025 15:28:49 -0800 Subject: [PATCH] fix(ci): Add final bytecode cache clear after installations The issue was timing - we were clearing cache before installations, but uv sync/pip install were creating new .pyc files. This commit: 1. Adds PYTHONDONTWRITEBYTECODE=1 to prevent .pyc generation 2. Clears bytecode cache AFTER all installations complete 3. Ensures no stale .pyc files exist before tests run For editable installs (-e .), Python loads from source directory, so clearing cache after installation ensures the resolver sees the latest method signatures with the authorization parameter. --- .github/actions/setup-runner/action.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-runner/action.yml b/.github/actions/setup-runner/action.yml index e6a7f064c..18de15bd2 100644 --- a/.github/actions/setup-runner/action.yml +++ b/.github/actions/setup-runner/action.yml @@ -28,6 +28,7 @@ runs: shell: bash env: UV_EXTRA_INDEX_URL: ${{ steps.client-config.outputs.uv-extra-index-url }} + PYTHONDONTWRITEBYTECODE: 1 run: | # Export UV env vars for current step and persist to GITHUB_ENV for subsequent steps if [ -n "$UV_EXTRA_INDEX_URL" ]; then @@ -43,11 +44,11 @@ runs: echo "Removing cached .venv directory" rm -rf .venv fi - + # Clear Python bytecode cache find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true find . -name "*.pyc" -delete 2>/dev/null || true - + # Clear uv's cache directory to force rebuilding wheels from source if [ -n "$UV_CACHE_DIR" ] && [ -d "$UV_CACHE_DIR" ]; then echo "Clearing UV cache at $UV_CACHE_DIR" @@ -69,5 +70,9 @@ runs: uv pip install ${{ steps.client-config.outputs.install-source }} fi + echo "Final cleanup: removing all bytecode cache after installations" + find . -name "*.pyc" -type f -delete 2>/dev/null || true + find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true + echo "Installed llama packages" uv pip list | grep llama