Repository navigation
Description
Overview
scripts/jax_assertions/multi_start_gradient_auto_convergence.py fails in the
workspace-smoke full-profile sweep with KeyError: 'total_steps' (PyAutoHeart run
30858578587,
job smoke / run_scripts (3.12, autofit_test, jax_assertions), 2026-08-03T22:28:40Z,
against released autofit 2026.7.29.2).
This is not a library contract break. The script's __Env__ section declares
ENV: jax, which releases only PYAUTO_DISABLE_JAX, so profile_smoke.yaml's
default PYAUTO_TEST_MODE: "2" still applies and the sampler is bypassed. The
bypass path never writes total_steps into samples_info, so the script's
line 123 read raises. The script asserts on a real fit's outcome and must run
the real search, exactly like its siblings in scripts/searches/.
Plan
- Change the script's declaration from
ENV: jaxtoENV: real_search jax, so
PYAUTO_TEST_MODEis released too and the search runs for real. - Move the rationale into the
__Env__section beside the declaration, mirroring
scripts/searches/MultiStartAdam.py. - Fix the stale
af.AbstractMultiStartGradientreference in the module docstring
(that symbol is not exported onaf), which currently trips the PyAuto API gate
on any local run of the script. - Re-run the script under the env
build_env_for_scriptresolves post-change and
confirm all three assertion blocks pass.
Detailed implementation plan
Root cause (reproduced locally 2026-08-04)
build_env_for_script(<script>, profile_smoke.yaml)resolves to
{'PYAUTO_TEST_MODE': '2', 'JAX_ENABLE_X64': 'True', ...}— thejaxtoken
releases onlyPYAUTO_DISABLE_JAX(autohands/env_config.py:47).- Under
PYAUTO_TEST_MODE=2,AbstractSearch._fit_bypass_test_mode
(autofit/non_linear/search/abstract_search.py:864) skips_fitentirely and
buildssamples_infofrom{total_iterations, time, log_evidence}plus
_test_mode_samples_info().AbstractMultiStartGradientdoes not override that
hook (only BlackJAX NUTS does), sototal_stepsis absent. - Script line 123
result.samples.samples_info["total_steps"]→KeyError.
Reproduced verbatim in ~4.5 s, matching CI's 4.7 s. samples_via_internal_fromhas writtentotal_stepsintosamples_infosince
63cd4e222(the original multi-start commit) and does so in released
2026.7.29.2 — the library never changed.- The bypass can never satisfy this script regardless: it asserts
normalization ≈ 25, and the bypass returns the prior median, which for
LogUniformPrior(1e-2, 1e2)is 1.0.
Not a regression
The identical failure is present in the previous workspace-smoke run
(30790463134,
2026-08-03T06:33Z). Pre-migration, profile_smoke.yaml gave jax_assertions/
only unset: [PYAUTO_DISABLE_JAX], so the #187/#189 declaration migration was a
genuine no-op here — the script has been broken under the smoke profile since it
was authored. It is not in smoke_tests.txt, so the per-PR gate is unaffected;
only the full-profile sweep runs it.
Library side considered and rejected
Adding a _test_mode_samples_info() override to AbstractMultiStartGradient
(as BlackJAX NUTS has) would supply a placeholder total_steps, but would only
convert a loud KeyError into a vacuous 0 < 300 pass followed by a confusing
truth-recovery failure. The NUTS-vs-MultiStart asymmetry is worth raising
separately, not as the repair here.
Affected Repositories
- autofit_workspace_test (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./autofit_workspace_test | main | clean |
active.md shows point-source-defaults-campaign claiming this repo on
feature/jax-pytree-traced-aux-fix — that claim is stale: PR
autofit_workspace_test#81 merged 2026-08-01T12:47:34Z and the checkout was
restored to main. Not a live conflict.
Suggested branch: feature/multi-start-auto-convergence-real-search
Worktree root: ~/Code/PyAutoLabs-wt/multi-start-auto-convergence-real-search/
Work Classification: Workspace
Implementation Steps
scripts/jax_assertions/multi_start_gradient_auto_convergence.py— in the
__Env__section, changeENV: jaxtoENV: real_search jaxand record why
(the script asserts a real fit'stotal_steps/ truth recovery; the bypass
returns the prior median and never writestotal_steps).- Same file, module docstring — drop the
af.prefix from
af.AbstractMultiStartGradient(the class lives in
autofit.non_linear.search.mle.multi_start_gradient, not on theaf
namespace). - Verify under the resolved smoke env, then
/ship_workspace.
Key Files
scripts/jax_assertions/multi_start_gradient_auto_convergence.py— the fix.config/build/profile_smoke.yaml— supplies thePYAUTO_TEST_MODE: "2"default
(unchanged; the declaration is the sanctioned per-script lever).scripts/searches/MultiStartAdam.py— the sibling to mirror (ENV: real_search jax).
Acceptance
The script passes under the resolved smoke env, running the real search.
Verified pre-fix by running with PYAUTO_TEST_MODE unset (output cleared first):
Auto-convergence stopped after 158 / 300 steps.
Recovered: centre=50.156, normalization=25.197, sigma=9.858
Auto-convergence early-stopped at the truth basin of the 1D Gaussian.
Resume path builds a byte-identical value_and_grad HLO (77848 chars)
Results-DB round-trip OK: converged=True, stop_reason=converged, fom_history trace length 158 (ceiling 300).
Wall time ~60 s (vs 4.7 s bypassed) — acceptable for the full-profile sweep, the
only place this script runs.
Original Prompt
Click to expand starting prompt
- multi_start_gradient_auto_convergence.py KeyError
In the PyAutoLabs workspace, this script fails in workspace-smoke:
autofit_workspace_test scripts/jax_assertions/multi_start_gradient_auto_convergence.py
KeyError: 'total_steps' (FAIL after 4.7s)Evidence: PyAutoHeart workspace-smoke run 30858578587, job
"smoke / run_scripts (3.12, autofit_test, jax_assertions)",
2026-08-03T22:28:40Z. Ran against released autofit 2026.7.29.2.Fails fast (4.7s), so it looks like a plain contract break between the
script and whatever dict it reads 'total_steps' from — likely a
MultiStartGradient progress/result structure that changed. Find who
writes that key, decide whether the library or the script is wrong, and
fix the owning side. Route through start_dev.
Activity
Jammy2211 commentedon Aug 4, 2026
Shipped — 2026-08-04
PRs
f4c45c1)Summary
scripts/jax_assertions/multi_start_gradient_auto_convergence.pynow declaresENV: real_search jaxinstead ofENV: jax, soPYAUTO_TEST_MODEis released andthe search actually runs. The
KeyError: 'total_steps'was never a librarycontract break — the sampler was being bypassed, and the bypass stub never writes
total_stepsintosamples_info. Also dropped the staleaf.prefix fromaf.AbstractMultiStartGradientin the module docstring. Docstring-only diff.Session Notes
Latent, not a regression. The identical failure is in the previous sweep
(PyAutoHeart run 30790463134). Pre-migration,
profile_smoke.yamlgavejax_assertions/onlyunset: [PYAUTO_DISABLE_JAX]— neverPYAUTO_TEST_MODE—so the #187/#189 declaration migration was a genuine no-op here and the fault
predates it. The script has been broken under the smoke profile since it was
authored. It is not in
smoke_tests.txt, so the per-PR gate was never affected.Library change considered and rejected.
AbstractMultiStartGradienthas no_test_mode_samples_info()override whileBlackJAXNUTSdoes. Adding one wouldhave supplied a placeholder
total_stepsbut only converted a loudKeyErrorinto a vacuous
0 < 300pass followed by a confusing truth-recovery failure(the bypass returns the prior median, and
LogUniformPrior(1e-2, 1e2)'s medianis 1.0, not the asserted 25). The asymmetry is filed separately as a PyAutoMind
draft prompt (
draft/bug/autofit/multi_start_test_mode_samples_info_gap.md)rather than patched over here.
Gotcha for anyone re-verifying. A second run of this script takes ~3.3 s
instead of ~10 s because PyAutoFit resumes the completed fit from the existing
output folder — the search does not re-run.
rm -rf output/jax_assertions/ multi_start_gradient_auto_convergencebefore timing or trusting a pass. Thedirectory sweep's 11/11 included one such resume; the fresh-output runs (10.0 s
and 11.1 s, both
EXIT=0) are the real evidence.Also cleaned up: the
point-source-defaults-campaignactive.mdentry stillclaimed
autofit_workspace_testat "PR #81 OPEN" — that PR merged 2026-08-01 andthe entry's own status line already said so. The stale claim was firing the
worktree conflict guard, and has been released.