Skip to content

Commit c18a522

Browse files
bloveclaude
andcommitted
ci: key python venv caches by repository so a rename cannot restore a stale venv
The venv caches were keyed on OS and lockfile hash only. A venv bakes in the absolute workspace path, and renaming the repository moved that path from /home/runner/work/angular-agent-framework to /home/runner/work/threadplane, so every restored venv had launcher shebangs pointing at an interpreter that no longer exists (uv run pytest: Failed to spawn). Adding github.repository to the key invalidates all of them at once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent b573ae9 commit c18a522

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,14 @@ jobs:
377377
with:
378378
python-version: '3.12'
379379
- run: npm ci
380+
# The venv bakes in the absolute workspace path (/home/runner/work/<repo>/<repo>),
381+
# so the key carries github.repository: a repository rename must not restore a
382+
# venv whose launcher shebangs point at the old path.
380383
- name: Cache examples-chat python venv
381384
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
382385
with:
383386
path: examples/chat/python/.venv
384-
key: uv-venv-${{ runner.os }}-py3.12-${{ hashFiles('examples/chat/python/uv.lock') }}
387+
key: uv-venv-${{ github.repository }}-${{ runner.os }}-py3.12-${{ hashFiles('examples/chat/python/uv.lock') }}
385388
- working-directory: examples/chat/python
386389
run: uv sync
387390
- run: npx nx run examples-chat-python:smoke --skip-nx-cache
@@ -411,7 +414,7 @@ jobs:
411414
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
412415
with:
413416
path: examples/chat/python/.venv
414-
key: uv-venv-${{ runner.os }}-py3.12-${{ hashFiles('examples/chat/python/uv.lock') }}
417+
key: uv-venv-${{ github.repository }}-${{ runner.os }}-py3.12-${{ hashFiles('examples/chat/python/uv.lock') }}
415418
- working-directory: examples/chat/python
416419
run: uv sync
417420
- name: Cache Playwright browsers
@@ -468,7 +471,7 @@ jobs:
468471
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
469472
with:
470473
path: examples/ag-ui/python/.venv
471-
key: uv-venv-${{ runner.os }}-py3.12-${{ hashFiles('examples/ag-ui/python/uv.lock') }}
474+
key: uv-venv-${{ github.repository }}-${{ runner.os }}-py3.12-${{ hashFiles('examples/ag-ui/python/uv.lock') }}
472475
- working-directory: examples/ag-ui/python
473476
run: uv sync
474477
- name: Check requirements.txt matches uv.lock
@@ -578,7 +581,7 @@ jobs:
578581
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
579582
with:
580583
path: ${{ matrix.cap.python }}/.venv
581-
key: uv-venv-${{ runner.os }}-py3.12-${{ matrix.cap.python }}-${{ hashFiles(format('{0}/uv.lock', matrix.cap.python)) }}
584+
key: uv-venv-${{ github.repository }}-${{ runner.os }}-py3.12-${{ matrix.cap.python }}-${{ hashFiles(format('{0}/uv.lock', matrix.cap.python)) }}
582585
- name: uv sync per-cap python
583586
if: matrix.cap.python != ''
584587
working-directory: ${{ matrix.cap.python }}

0 commit comments

Comments
 (0)