Overview
Nine workspace scripts fail under the release-fidelity profile (PyAutoHeart run 28784914443, issue PyAutoHeart#27) with a KeyError raised in autofit/non_linear/samples/sample.py::parameter_lists_for_paths: a loaded sample's stored kwargs keys no longer align with the current model's paths. This is a high-severity, ecosystem-scope runtime regression whose fix belongs in the PyAutoFit resolution contract — not in the user-facing workspace scripts.
Plan
- Reproduce the
KeyError on clean main for a representative subset (single, multi-analysis, chained, list-profile, multi-dataset) to confirm the cluster is still live.
- Trace model-path construction vs. stored sample kwargs through
Sample / Samples / result-loading to classify the mismatch (path alias, collection/list index, or genuinely retired stored-key format).
- Fix the PyAutoFit path-resolution contract so valid current-model paths resolve against stored samples; a single general fix, split into more than one PR only if sub-causes diverge.
- Add focused regression tests in
test_autofit/non_linear/samples/test_samples.py covering the represented path categories.
- Ship the PyAutoFit PR (pending-release); a separate Phase 2 re-validates the 9 scripts under the release profile and edits only scripts using a genuinely retired API.
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary — library fix)
- autogalaxy_workspace, autolens_workspace (downstream verification only, Phase 2)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoFit |
main |
clean |
| ./autogalaxy_workspace |
main |
dirty (generated outputs; irrelevant to library phase) |
| ./autolens_workspace |
main |
dirty (generated outputs; irrelevant to library phase) |
Suggested branch: feature/samples-parameter-paths
Worktree: ~/Code/PyAutoLabs-wt/samples-parameter-paths/
Implementation Steps
- Reproduce on clean
main under the release profile for 1–2 representative scripts (via the vitals faculty) — confirm the KeyError still fires before fixing.
- Root-cause in
autofit/non_linear/samples/sample.py: parameter_lists_for_paths (line 104), is_path_kwargs (line 119), subsample (line 130); and how Samples builds all_paths / all_names and how directory/database loading repopulates kwargs.
- Fix at the resolution boundary so valid current-model paths resolve against stored sample kwargs. Do not catch/mask the error or weaken workspace scripts.
- Add regression tests in
test_autofit/non_linear/samples/test_samples.py covering single, multi-analysis, chained, list-profile, and multi-dataset path shapes.
- Run
python -m pytest test_autofit/; note any public-API change for downstream consumers.
Key Files
autofit/non_linear/samples/sample.py — the KeyError locus and path/kwargs resolution.
autofit/non_linear/samples/* (Samples container + directory/database loaders) — where stored kwargs are repopulated.
test_autofit/non_linear/samples/test_samples.py — regression coverage.
Fix locus / guardrails (from the Bug Agent BugDecision)
- severity=high · scope=ecosystem · type=runtime-error · owner=autofit
- Fix locus: library source (general fix) — resolving the contract clears the whole class.
- Strategy: split-into-phases (prefer small shippable PRs); workflow: combined (library ships first).
- Do NOT edit workspace scripts to mask it (no injected env-vars / hard-coded paths /
os.environ mutation / silent guards).
- Validate via the vitals faculty after patching (lib-tests, then workspace/integration), targeting pyauto-heart GREEN/YELLOW before ship.
Original Prompt
Click to expand starting prompt
Fix release result/sample parameter-path regressions
Context
PyAutoHeart release validation run 28784914443 exposed a family of workspace
failures. Against current main, nine scripts converge on
PyAutoFit/autofit/non_linear/samples/sample.py::parameter_lists_for_paths
raising KeyError for model paths that no longer match stored sample kwargs.
Primary repository: @PyAutoFit. Downstream verification repositories:
@autogalaxy_workspace and @autolens_workspace.
Scripts
autogalaxy_workspace/scripts/imaging/features/pixelization/galaxy_reconstruction.py
autogalaxy_workspace/scripts/imaging/features/shapelets/modeling.py
autogalaxy_workspace/scripts/multi/features/imaging_and_interferometer/modeling.py
autolens_workspace/scripts/group/features/advanced/mass_stellar_dark/chaining.py
autolens_workspace/scripts/guides/modeling/advanced/hierarchical.py
autolens_workspace/scripts/imaging/features/advanced/shapelets/modeling.py
autolens_workspace/scripts/interferometer/features/subhalo/detect/start_here.py
autolens_workspace/scripts/interferometer/features/extra_galaxies/slam.py
autolens_workspace/scripts/multi/features/imaging_and_interferometer/modeling.py
Required work
- Reproduce from clean task worktrees with the release profile and current library
sources; distinguish stale cached output from newly written samples.
- Trace model path construction, stored kwargs, path aliases, and collection/list
indices through Samples, Sample, and result loading.
- Fix the owning PyAutoFit contract if valid current-model paths cannot resolve.
Do not weaken workspace scripts or silently ignore missing parameters.
- Add focused PyAutoFit regression tests covering single, multi-analysis, chained,
list-profile, and multi-dataset paths represented above.
- Run PyAutoFit pytest, then rerun all nine scripts under their release profiles.
Preserve tutorial prose and make workspace edits only where a script genuinely uses a
retired API rather than exposing a library defect.
🤖 Filed via /bug → Bug Agent → /start_dev. Source: PyAutoHeart#27 release-fidelity validation.
Overview
Nine workspace scripts fail under the release-fidelity profile (PyAutoHeart run
28784914443, issue PyAutoHeart#27) with aKeyErrorraised inautofit/non_linear/samples/sample.py::parameter_lists_for_paths: a loaded sample's stored kwargs keys no longer align with the current model's paths. This is a high-severity, ecosystem-scope runtime regression whose fix belongs in the PyAutoFit resolution contract — not in the user-facing workspace scripts.Plan
KeyErroron cleanmainfor a representative subset (single, multi-analysis, chained, list-profile, multi-dataset) to confirm the cluster is still live.Sample/Samples/ result-loading to classify the mismatch (path alias, collection/list index, or genuinely retired stored-key format).test_autofit/non_linear/samples/test_samples.pycovering the represented path categories.Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch:
feature/samples-parameter-pathsWorktree:
~/Code/PyAutoLabs-wt/samples-parameter-paths/Implementation Steps
mainunder the release profile for 1–2 representative scripts (via the vitals faculty) — confirm theKeyErrorstill fires before fixing.autofit/non_linear/samples/sample.py:parameter_lists_for_paths(line 104),is_path_kwargs(line 119),subsample(line 130); and howSamplesbuildsall_paths/all_namesand how directory/database loading repopulateskwargs.test_autofit/non_linear/samples/test_samples.pycovering single, multi-analysis, chained, list-profile, and multi-dataset path shapes.python -m pytest test_autofit/; note any public-API change for downstream consumers.Key Files
autofit/non_linear/samples/sample.py— theKeyErrorlocus and path/kwargs resolution.autofit/non_linear/samples/*(Samples container + directory/database loaders) — where storedkwargsare repopulated.test_autofit/non_linear/samples/test_samples.py— regression coverage.Fix locus / guardrails (from the Bug Agent BugDecision)
os.environmutation / silent guards).Original Prompt
Click to expand starting prompt
Fix release result/sample parameter-path regressions
Context
PyAutoHeart release validation run
28784914443exposed a family of workspacefailures. Against current
main, nine scripts converge onPyAutoFit/autofit/non_linear/samples/sample.py::parameter_lists_for_pathsraising
KeyErrorfor model paths that no longer match stored sample kwargs.Primary repository: @PyAutoFit. Downstream verification repositories:
@autogalaxy_workspace and @autolens_workspace.
Scripts
autogalaxy_workspace/scripts/imaging/features/pixelization/galaxy_reconstruction.pyautogalaxy_workspace/scripts/imaging/features/shapelets/modeling.pyautogalaxy_workspace/scripts/multi/features/imaging_and_interferometer/modeling.pyautolens_workspace/scripts/group/features/advanced/mass_stellar_dark/chaining.pyautolens_workspace/scripts/guides/modeling/advanced/hierarchical.pyautolens_workspace/scripts/imaging/features/advanced/shapelets/modeling.pyautolens_workspace/scripts/interferometer/features/subhalo/detect/start_here.pyautolens_workspace/scripts/interferometer/features/extra_galaxies/slam.pyautolens_workspace/scripts/multi/features/imaging_and_interferometer/modeling.pyRequired work
sources; distinguish stale cached output from newly written samples.
indices through
Samples,Sample, and result loading.Do not weaken workspace scripts or silently ignore missing parameters.
list-profile, and multi-dataset paths represented above.
Preserve tutorial prose and make workspace edits only where a script genuinely uses a
retired API rather than exposing a library defect.
🤖 Filed via
/bug→ Bug Agent →/start_dev. Source: PyAutoHeart#27 release-fidelity validation.