The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
ci: drop the PM toolchain smoke matrix; key the tools cache on the PM code
ethernet3a6e61b189f4
diff --git a/.github/actions/save-pm-cache/README.md b/.github/actions/save-pm-cache/README.mdindex ead91363448..e9140a813ca 100644--- a/.github/actions/save-pm-cache/README.md+++ b/.github/actions/save-pm-cache/README.md@@ -17,10 +17,10 @@ different contents under the same key.Restore tries the current dependency set's rolling snapshots first, then thecompatible v2 prefix. There is no fallback to older cache formats. This letsa retry add wheels to a snapshot saved by a partially failed build. The ordinary-automatic cache path and its exact-hit smoke tests remain available.+automatic cache path remains available.-Smoke namespaces precede the native/dependency identity, outside production's-restore prefix. PM Toolchain cleanup removes its run-scoped snapshots.+Suffixed namespaces precede the native/dependency identity, outside production's+restore prefix.Before saving, `python -m pm.build_env --exact-lock --cache PATH --lock-source REPO`deletes every entry the project's `uv.lock` cannot resolve. It keeps downloadeddiff --git a/.github/actions/setup-pm/README.md b/.github/actions/setup-pm/README.mdindex a29ac669ab3..f4bd3159a92 100644--- a/.github/actions/setup-pm/README.md+++ b/.github/actions/setup-pm/README.md@@ -81,9 +81,7 @@ Outputs include `python-version`, `uv-version`, `node-version`, `npm-version`,`python-path`, `venv`, `target`, and the three `*-cache-hit` flags.Use the version outputs in installed-tree cache keys instead of repeating pins.-`.github/workflows/pm-toolchain.yml` exercises cold setup and a separate warm-runner for Linux, macOS and Windows on both architectures. Its optional cache-suffix isolates cache lookup, not the repository's storage budget. The trusted-`pm-toolchain-cache-cleanup.yml` completion workflow deletes only that run's-smoke keys after all cache saves finish, including failed or cancelled runs.-It must be on the default branch for GitHub to run it.+The tools cache key hashes `pm/**`, this action, and `scripts/ci/setup_toolchain.py`,+so a provisioning change re-runs the cold path on every lane that uses the action+(`tests-os.yml` covers macOS and both Windows architectures). `cache-suffix` is an+optional namespace for isolated cache experiments; it changes lookup, not storage.diff --git a/.github/actions/setup-pm/action.yml b/.github/actions/setup-pm/action.ymlindex 84dc60bff60..614bc7f5a7b 100644--- a/.github/actions/setup-pm/action.yml+++ b/.github/actions/setup-pm/action.yml@@ -107,13 +107,16 @@ runs:"$bootstrap" -S "$_PM_ACTION/../../../scripts/ci/setup_toolchain.py" prepare \--toolchain "$_PM_TOOLCHAIN" --extras "$_PM_EXTRAS" --packages "$_PM_PACKAGES" --home "$RUNNER_TEMP/setup-pm"+ # The key covers the PM code and this action, not only the lock: a+ # provisioning change must re-run the cold path on every lane rather+ # than restore a store the previous code wrote.- name: Cache verified PM toolsid: tools-cacheif: inputs.cache == 'true' && inputs.save-tools-cache == 'true'uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: ${{ steps.prepare.outputs.store }}- key: setup-pm-tools-v1-${{ steps.prepare.outputs.target }}-${{ inputs.toolchain }}${{ steps.prepare.outputs.extra-packages }}-${{ hashFiles('pm/lock.json') }}-${{ inputs.cache-suffix }}+ key: setup-pm-tools-v1-${{ steps.prepare.outputs.target }}-${{ inputs.toolchain }}${{ steps.prepare.outputs.extra-packages }}-${{ hashFiles('pm/**', '.github/actions/setup-pm/**', 'scripts/ci/setup_toolchain.py') }}-${{ inputs.cache-suffix }}- name: Restore verified PM tools without savingid: tools-cache-restore@@ -121,7 +124,7 @@ runs:uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: ${{ steps.prepare.outputs.store }}- key: setup-pm-tools-v1-${{ steps.prepare.outputs.target }}-${{ inputs.toolchain }}${{ steps.prepare.outputs.extra-packages }}-${{ hashFiles('pm/lock.json') }}-${{ inputs.cache-suffix }}+ key: setup-pm-tools-v1-${{ steps.prepare.outputs.target }}-${{ inputs.toolchain }}${{ steps.prepare.outputs.extra-packages }}-${{ hashFiles('pm/**', '.github/actions/setup-pm/**', 'scripts/ci/setup_toolchain.py') }}-${{ inputs.cache-suffix }}- name: Preserve and retrieve the pinned toolchainif: inputs.archive-inputs == 'true'diff --git a/.github/workflows/pm-toolchain-cache-cleanup.yml b/.github/workflows/pm-toolchain-cache-cleanup.ymldeleted file mode 100644index 1c3be9422a2..00000000000--- a/.github/workflows/pm-toolchain-cache-cleanup.yml+++ /dev/null@@ -1,31 +0,0 @@-name: Clean PM toolchain smoke caches--# workflow_run uses default-branch code, not the PR's checkout. Cleanup also-# runs for failed/cancelled smoke workflows after all cache post steps finish.-on:- workflow_run:- workflows: [PM Toolchain]- types: [completed]--permissions:- contents: read- actions: write--concurrency:- group: pm-smoke-cleanup-${{ github.event.workflow_run.id }}- cancel-in-progress: false--jobs:- cleanup:- runs-on: ubuntu-24.04- timeout-minutes: 10- steps:- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- ref: ${{ github.event.repository.default_branch }}- persist-credentials: false- - name: Remove only this completed run's isolated caches- env:- GH_TOKEN: ${{ github.token }}- SMOKE_RUN_ID: ${{ github.event.workflow_run.id }}- run: python3 scripts/ci/cleanup_pm_toolchain_caches.py "$SMOKE_RUN_ID"diff --git a/.github/workflows/pm-toolchain-smoke.yml b/.github/workflows/pm-toolchain-smoke.ymldeleted file mode 100644index e7eae0e008d..00000000000--- a/.github/workflows/pm-toolchain-smoke.yml+++ /dev/null@@ -1,105 +0,0 @@-name: PM toolchain native smoke-on:- workflow_call:- inputs:- warm:- type: boolean- required: true-permissions:- contents: read-jobs:- native:- name: ${{ inputs.warm && 'warm' || 'cold' }} ${{ matrix.target }}- runs-on: ${{ matrix.runner }}- timeout-minutes: ${{ inputs.warm && 15 || 35 }}- strategy:- fail-fast: false- matrix:- include:- - target: linux-x64- runner: ubuntu-24.04- - target: linux-arm64- runner: ubuntu-24.04-arm- - target: darwin-x64- runner: macos-15-intel- - target: darwin-arm64- runner: macos-15- - target: win32-x64- runner: windows-2025- - target: win32-arm64- runner: windows-11-arm- steps:- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- persist-credentials: false-- # The dev extra can build ARM64 sdists during setup-pm itself.- - name: Set up native ARM64 build dependencies- if: matrix.target == 'win32-arm64'- uses: ./.github/actions/setup-windows-build-deps-- - name: Set up tools and dev extra from PM- id: pm- uses: ./.github/actions/setup-pm- with:- toolchain: all- extras: '["dev"]'- # Production callers prune before saving; the warm restore must- # work from a pruned cache, so the smoke saves one too.- prune-python-cache: true- # Each workflow run proves a genuinely cold save followed by a- # different runner restoring it. No pre-existing cache can mask it.- cache-suffix: smoke-${{ github.run_id }}-${{ github.run_attempt }}-- - name: Verify next-step PATH and exact cache hits- shell: bash- env:- EXPECT_WARM: ${{ inputs.warm }}- TOOLS_HIT: ${{ steps.pm.outputs.tools-cache-hit }}- PYTHON_HIT: ${{ steps.pm.outputs.python-cache-hit }}- NODE_HIT: ${{ steps.pm.outputs.node-cache-hit }}- run: |- python scripts/ci/verify_toolchain.py --extras- python -c 'import os; expected=os.environ["EXPECT_WARM"]=="true"; values={k:os.environ[k]=="true" for k in ("TOOLS_HIT","PYTHON_HIT","NODE_HIT")}; print(values); assert all(v==expected for v in values.values()), values'-- # Cold populates the npm cache; warm must complete the same install- # without the network. That is the restore proof for the node half.- - name: Install the real locked npm workspace- shell: bash- env:- EXPECT_WARM: ${{ inputs.warm }}- run: |- flags=()- if [ "$EXPECT_WARM" = true ]; then flags+=(--offline); fi- npm ci --workspace tests-js --include-workspace-root --include=dev --ignore-scripts --no-audit --no-fund ${flags[@]+"${flags[@]}"}-- # The cold leg is the only runner for these on linux-arm64, darwin-x64- # and win32-arm64 (tests-os selects platform-marked files only). Warm- # runs the same commit on the same tree, so it skips them.- - name: Run the PM and action contracts- if: ${{ !inputs.warm }}- shell: bash- run: |- scripts/run_tests.sh -j 2 tests/scripts/test_setup_toolchain.py tests/pm/test_pm_core.py tests/pm/test_bootstrap_import_closure.py tests/pm/test_uv_cache.py tests/pm/test_windows_build_deps.py- python scripts/ci/verify_toolchain.py --extras-- # Build-side consumers of the provisioned toolchain. One target is- # enough: the vitest halves already run under js-tests.- - name: Exercise the docs, payload and icon build entrypoints- if: ${{ !inputs.warm && matrix.target == 'linux-x64' }}- shell: bash- run: |- python -m scripts.ci.python_packages ascii-guard==2.3.0 ruamel.yaml==0.18.17 httpx==0.28.1 -- -c 'import ruamel.yaml,httpx; print(ruamel.yaml.__version__, httpx.__version__)'- npm ci --workspace apps/desktop --include-workspace-root --include=dev --ignore-scripts --no-audit --no-fund- npm run payload --workspace apps/desktop -- --help- node scripts/generate-icons.mjs- node scripts/generate-icons.mjs --check-- - name: Upload native setup proof- if: always()- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- with:- name: pm-toolchain-${{ matrix.target }}-${{ inputs.warm && 'warm' || 'cold' }}- path: ${{ runner.temp }}/pm-toolchain-proof.json- if-no-files-found: warn- retention-days: 7diff --git a/.github/workflows/tests-os.yml b/.github/workflows/tests-os.ymlindex 8b9dd102a3d..8d7d8dd5954 100644--- a/.github/workflows/tests-os.yml+++ b/.github/workflows/tests-os.yml@@ -12,7 +12,7 @@ name: OS-specific tests# is where those markers actually execute:## macos → ``-m platforms`` on macos-latest-# windows → ``-m platforms`` on windows-latest-32-core+# windows → ``-m platforms`` on windows-latest-32-core and windows-11-arm## (tests/conftest.py's ``pytest_collection_modifyitems`` hook skips# foreign-OS ``platforms(...)`` markers on each host, so one shared ``-m@@ -53,7 +53,8 @@ jobs:os-tests:name: ${{ matrix.name }}runs-on: ${{ matrix.runner }}- timeout-minutes: 30+ # windows-11-arm is a 4-core runner that builds sdists on the way in.+ timeout-minutes: ${{ matrix.timeout || 30 }}strategy:fail-fast: falsematrix:@@ -64,10 +65,19 @@ jobs:- name: Windows-only testsrunner: windows-latest-32-coremarker: windows+ - name: Windows-only tests (arm64)+ runner: windows-11-arm+ marker: windows+ timeout: 60steps:- name: Checkout codeuses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ # No arm64 wheels for some of the extras below: PM builds them from sdist.+ - name: Set up native ARM64 build dependencies+ if: runner.os == 'Windows' && runner.arch == 'ARM64'+ uses: ./.github/actions/setup-windows-build-deps+- name: Set up locked Python and test dependenciesuses: ./.github/actions/setup-pmwith:@@ -146,7 +156,7 @@ jobs:env:# These files spawn nested PowerShell trees. CPU-count parallelism# starves cold child startup before the fixture's idle deadline.- HERMES_TEST_WORKERS: ${{ matrix.marker == 'windows' && '8' || '' }}+ HERMES_TEST_WORKERS: ${{ matrix.marker == 'windows' && (runner.arch == 'ARM64' && '2' || '8') || '' }}# Belt-and-suspenders with tests/conftest.py's env blanking: no# test may reach a real provider API.OPENROUTER_API_KEY: ""diff --git a/.github/workflows/pm-toolchain.yml b/.github/workflows/windows-bundle-sdk.ymlsimilarity index 59%rename from .github/workflows/pm-toolchain.ymlrename to .github/workflows/windows-bundle-sdk.ymlindex f47fd171cdb..789d4a621a9 100644--- a/.github/workflows/pm-toolchain.yml+++ b/.github/workflows/windows-bundle-sdk.yml@@ -1,38 +1,26 @@-name: PM Toolchain+name: Windows bundle SDK+# The desktop signing adapter downloads and executes the pinned Windows SDK+# tools. The vitest halves under js-tests run on Linux and skip every+# runIf(win32) leg, so this is the only lane that runs the real downloader.on:- push:- branches: [ci/pm-toolchain]pull_request:paths:- - '.github/actions/setup-pm/**'- - '.github/actions/save-pm-cache/**'- - '.github/actions/setup-windows-build-deps/**'- - 'scripts/windows-build-deps.ps1'- - 'scripts/build/windows-deps.ps1'- - 'scripts/build/windows_deps.py'- - 'tests/pm/test_windows_build_deps.py'- - '.github/workflows/pm-toolchain*.yml'- - 'scripts/ci/*toolchain.py'- - 'tests/scripts/test_setup_toolchain.py'- - 'tests-js/setup-pm-post.test.mjs'- - 'tests-js/setup-pm-cache.test.mjs'- - 'pm/**'+ - 'apps/desktop/scripts/windows-bundle-tools.mjs'+ - 'apps/desktop/scripts/windows-bundle-tools.test.mjs'+ - 'scripts/msix-shared.mjs'+ - 'apps/desktop/scripts/msix-shared.test.mjs'+ - 'apps/desktop/scripts/sign-msix.mjs'+ - 'apps/desktop/scripts/sign-msix.test.mjs'+ - 'apps/desktop/scripts/batch-sign-binaries.mjs'+ - 'apps/desktop/scripts/batch-sign-binaries.test.mjs'+ - '.github/workflows/windows-bundle-sdk.yml'workflow_dispatch:permissions:contents: readconcurrency:- group: pm-toolchain-${{ github.ref }}+ group: windows-bundle-sdk-${{ github.ref }}cancel-in-progress: truejobs:- cold:- uses: ./.github/workflows/pm-toolchain-smoke.yml- with:- warm: false- warm:- needs: cold- uses: ./.github/workflows/pm-toolchain-smoke.yml- with:- warm: truewindows-bundle-tools:name: Cold Windows SDK (${{ matrix.runner }})runs-on: ${{ matrix.runner }}diff --git a/scripts/ci/cleanup_pm_toolchain_caches.py b/scripts/ci/cleanup_pm_toolchain_caches.pydeleted file mode 100644index 729e0fb2583..00000000000--- a/scripts/ci/cleanup_pm_toolchain_caches.py+++ /dev/null@@ -1,64 +0,0 @@-"""Remove only run-isolated caches after a PM Toolchain smoke run completes."""-from __future__ import annotations--import argparse-import json-import os-import re-import subprocess---def cleanup_run_caches(run_id: str, request, *, page_size: int = 100) -> list[int]:- if not re.fullmatch(r"[1-9][0-9]*", run_id):- raise ValueError("invalid run ID")- run = request("GET", f"actions/runs/{run_id}")- if run["status"] != "completed" or run["path"] != ".github/workflows/pm-toolchain.yml":- raise ValueError("cleanup requires a completed PM Toolchain run")- pattern = re.compile(- rf"^(?:(?:setup-pm-tools-|node-cache-).*-smoke(?:-prune|-consumers)?-{run_id}-[1-9][0-9]*"- rf"|setup-pm-uv-v[23]-smoke(?:-prune|-consumers)?-{run_id}-[1-9][0-9]*-.+)$"- )-- def collect():- # Finish pagination before deleting: deletion shifts the next page.- rows = []- page = 1- while True:- data = request("GET", f"actions/caches?per_page={page_size}&page={page}")- rows.extend(data["actions_caches"])- if len(rows) >= data["total_count"]:- return [row for row in rows if pattern.fullmatch(row["key"])]- if not data["actions_caches"]:- raise RuntimeError("cache inventory ended before its declared total")- page += 1-- selected = collect()- for row in selected:- request("DELETE", f"actions/caches/{row['id']}")- print(f"deleted smoke cache {row['id']}: {row['key']}")- remaining = collect()- if remaining:- raise RuntimeError(f"smoke caches remain after cleanup: {[row['id'] for row in remaining]}")- return [row["id"] for row in selected]---def main() -> None:- parser = argparse.ArgumentParser(description=__doc__)- parser.add_argument("run_id")- args = parser.parse_args()- repository = os.environ["GITHUB_REPOSITORY"]- if not re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", repository):- raise ValueError("invalid repository")- def request(method, path):- result = subprocess.run(- ["gh", "api", "--method", method, f"repos/{repository}/{path}"],- check=True, capture_output=True, text=True, encoding="utf-8", timeout=90,- )- return json.loads(result.stdout) if result.stdout.strip() else None-- removed = cleanup_run_caches(args.run_id, request)- print(f"removed {len(removed)} run-isolated caches")---if __name__ == "__main__":- main()diff --git a/scripts/ci/verify_toolchain.py b/scripts/ci/verify_toolchain.pydeleted file mode 100644index 4a71c41ffe6..00000000000--- a/scripts/ci/verify_toolchain.py+++ /dev/null@@ -1,69 +0,0 @@-"""Native setup-pm smoke: verify PATH, PM identity and installed extras."""-from __future__ import annotations--import argparse-import json-import os-from pathlib import Path-import shutil-import subprocess-import sys--if __package__ in (None, ""):- sys.path.insert(0, str(Path(__file__).resolve().parents[2]))--from pm.lock import Facts, Lockfile-from pm.package import machine_matches_binary-from pm.paths import facts_path, lockfile_path, runtime_facts_path, store_root-from pm.registry import get_package-from pm.store import current_target, tree_digest---def main() -> None:- parser = argparse.ArgumentParser(description=__doc__)- parser.add_argument("--extras", action="store_true")- args = parser.parse_args()- lock = Lockfile(lockfile_path())- facts = Facts(facts_path())- target = current_target()- rows = {}- for name in ("python", "python3", "node", "npm", "npx"):- binary = shutil.which(name)- if binary is None:- raise RuntimeError(f"{name} is missing from PATH")- result = subprocess.check_output([binary, "--version"], text=True, encoding="utf-8", timeout=60).strip()- package = {"python3": "python", "npx": "npm"}.get(name, name)- pin = lock.version(package)- expected = pin.partition("+")[0]- actual = result.split()[1] if package == "python" else result.removeprefix("v")- if actual != expected:- raise RuntimeError(f"{name} on PATH is {result}, expected {pin}: {binary}")- entry = store_root() / facts.get(package)["entry"]- artifact = get_package(package).binary(entry, target)- if facts.get(package)["artifacts"] != [a["sha256"] for a in lock.artifacts(package, target)]:- raise RuntimeError(f"{name} has the wrong pinned artifact identity")- if machine_matches_binary(artifact, target) is False:- raise RuntimeError(f"{name} is not native {target}")- if package == name and facts.get(package)["digest"] != tree_digest(entry):- raise RuntimeError(f"{name} store was mutated after verification")- rows[name] = {"path": binary, "version": result, "target": target}- if args.extras:- if Facts(runtime_facts_path()).get("venv") is not None:- raise RuntimeError("CI test dependencies must not publish a runtime generation")- if Path(sys.prefix).resolve() != Path(os.environ["VIRTUAL_ENV"]).resolve():- raise RuntimeError("PATH Python did not select the isolated test environment")- import pytest- import ruamel.yaml-- rows["dependencies"] = {"pytest": pytest.__version__, "ruamel.yaml": ruamel.yaml.__version__}- code = "import sys,pytest; print(sys.prefix); print(pytest.__version__)"- probe = subprocess.check_output([shutil.which("python3"), "-c", code], text=True, encoding="utf-8", timeout=60)- if pytest.__version__ not in probe:- raise RuntimeError("python3 did not inherit the installed dev extra")- print(json.dumps(rows, indent=2))- destination = Path(os.environ["RUNNER_TEMP"]) / "pm-toolchain-proof.json"- destination.write_text(json.dumps(rows, indent=2), encoding="utf-8")---if __name__ == "__main__":- main()diff --git a/tests/ci/test_cleanup_pm_toolchain_caches.py b/tests/ci/test_cleanup_pm_toolchain_caches.pydeleted file mode 100644index e6b85c1c45f..00000000000--- a/tests/ci/test_cleanup_pm_toolchain_caches.py+++ /dev/null@@ -1,52 +0,0 @@-"""Smoke cache cleanup is bound to completed PM runs and exact key namespaces."""-from __future__ import annotations--import pytest--from scripts.ci.cleanup_pm_toolchain_caches import cleanup_run_caches---def test_cleanup_collects_all_pages_then_deletes_only_its_run():- rows = [- {"id": 1, "key": "setup-pm-tools-x64-smoke-42-1"},- {"id": 2, "key": "node-cache-Windows-x64-smoke-42-2"},- {"id": 3, "key": "setup-pm-uv-v2-smoke-prune-42-1-linux-x64-os-python-true-lock"},- {"id": 4, "key": "setup-pm-tools-x64-smoke-consumers-42-1"},- {"id": 5, "key": "setup-pm-tools-x64-smoke-420-1"},- {"id": 6, "key": "node-cache-Windows-x64-normal"},- {"id": 7, "key": "payload-signatures-smoke-42-1"},- ]- removed = []- pages_read = []-- def request(method, path):- if path == "actions/runs/42":- return {"status": "completed", "path": ".github/workflows/pm-toolchain.yml"}- if method == "DELETE":- assert pages_read[:4] == [1, 2, 3, 4]- removed.append(int(path.rsplit("/", 1)[-1]))- rows[:] = [row for row in rows if row["id"] != removed[-1]]- return None- page = int(path.rsplit("page=", 1)[-1])- pages_read.append(page)- return {"total_count": len(rows), "actions_caches": rows[(page - 1) * 2:page * 2]}-- assert cleanup_run_caches("42", request, page_size=2) == [1, 2, 3, 4]- assert removed == [1, 2, 3, 4]- assert {row["id"] for row in rows} == {5, 6, 7}--[email protected]("status,path", [- ("in_progress", ".github/workflows/pm-toolchain.yml"),- ("completed", ".github/workflows/desktop-bundled-release.yml"),-])-def test_cleanup_refuses_active_or_unrelated_runs(status, path):- calls = []-- def request(method, route):- calls.append((method, route))- return {"status": status, "path": path}-- with pytest.raises(ValueError, match="completed PM Toolchain run"):- cleanup_run_caches("42", request)- assert calls == [("GET", "actions/runs/42")]