From b1afb3e7d0b2903b6540d82f21d71540cdc3c7ba Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 18:06:16 +0000 Subject: [PATCH] ci(smoke): persist every JAX compile in the smoke leg (threshold 0) `smoke-tests.yml` restores and saves a JAX compilation cache but set no compile-time threshold, so autonerves' setdefault of 1s won and only executables that took over a second were ever written. The smoke scripts are hundreds of sub-second compiles each, so a "hit" cache held 1-4 entries and every run re-paid the compile. Export JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS="0" in the runner step env, beside JAX_COMPILATION_CACHE_DIR, so every script subprocess inherits it. Measured locally on the three slowest JAX scripts: 23-31s -> 10-18s, 2->513 / 4->299 / 1->~490 entries, output byte-identical. The price is cache-artefact size (~3 MB per JAX script per python leg); rollback is this one line or a PYAUTO_CACHE_EPOCH bump. Wiring test pins the key and that the runner command is still untouched. Closes #221 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01NWYEAsAsN5cfuqqBoYTHho --- .github/workflows/smoke-tests.yml | 11 +++++++++++ tests/test_smoke_tests_wiring.py | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 9aa94ed7..54ef1892 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -589,6 +589,17 @@ jobs: # subprocess, so each script's JAX writes to and reads from the same # compilation cache instead of one per-process temporary. JAX_COMPILATION_CACHE_DIR: ${{ github.workspace }}/.pyauto_jax_cache + # Persist EVERY compile, not only those over JAX's 1.0s default + # (autonerves setdefaults the same 1s whenever the cache dir is set; + # a preset value wins). The smoke scripts are hundreds of sub-second + # compiles each, so under the 1s regime a "hit" cache held 1-4 + # entries and every run re-paid the compile: measured 2->513, + # 4->299 and 1->~490 entries on the three slowest JAX scripts, and + # 23-31s -> 10-18s per script, output byte-identical. The price is + # cache-artefact size (~500 entries / ~3 MB per JAX script, per + # python leg); the way out is this one line, or an epoch bump to + # drop the fat caches. + JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS: "0" # Via env, never interpolated into the script body: these inputs reach # here from a caller's workflow_dispatch, and `${{ }}` inside `run:` # would splice their text straight into the shell. diff --git a/tests/test_smoke_tests_wiring.py b/tests/test_smoke_tests_wiring.py index 053fd89b..c317dece 100644 --- a/tests/test_smoke_tests_wiring.py +++ b/tests/test_smoke_tests_wiring.py @@ -103,11 +103,26 @@ def test_the_runner_step_names_both_cache_dirs_and_is_otherwise_untouched(): # cache the cache steps could not name, and the runner copies this job env # into every script subprocess, so all of them share the one directory. assert cache_dir.startswith("${{ github.workspace }}/") - # The command itself is untouched — one env key is the whole change. + # The command itself is untouched — the env keys are the whole change. assert 'python "$RUNNER" $RUNNER_ARGS' in step["run"] assert "continue-on-error" not in step +def test_the_runner_persists_every_compile_it_makes(): + """JAX (and autonerves, whenever the cache dir is set) only persist an + executable that took over a second to compile. The smoke scripts are + hundreds of sub-second compiles each, so under that default a "hit" cache + held 1-4 entries and every run re-paid the compile. The threshold is set + where the cache dir is set — the same step env the runner copies into + every script subprocess — and it is exactly "0", not a smaller-but-nonzero + value a faster runner could silently drop a compile under (PyAutoHeart#221).""" + step = _step(_steps(), RUNNER_STEP) + assert step["env"]["JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS"] == "0" + assert "JAX_COMPILATION_CACHE_DIR" in step["env"] + # Still an env-only change: the runner command is a workspace's own. + assert 'python "$RUNNER" $RUNNER_ARGS' in step["run"] + + # --- placement, and non-fatality -------------------------------------------- def test_the_cache_steps_sit_between_the_install_and_the_upload_in_order():