Skip to content

add autobuild repro_command for triage script reproduction#90

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/autobuild-repro-command
May 20, 2026
Merged

add autobuild repro_command for triage script reproduction#90
Jammy2211 merged 1 commit into
mainfrom
feature/autobuild-repro-command

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Add autobuild repro_command <script> — a small helper that emits the exact shell command autobuild would have used to run one workspace script, including the env vars from the workspace's config/build/env_vars.yaml. Solves a recurring triage-handoff pain point: when pasting failing scripts into chats or issues, the chat-side reader couldn't reproduce the failure because python3 <script> omits the autobuild-injected env (PYAUTO_TEST_MODE, PYAUTO_SMALL_DATASETS, PYAUTO_FAST_PLOTS, etc.) and per-pattern set: / unset: overrides. The new helper emits a self-contained one-liner like (cd <workspace> && env KEY=val ... python3 <script>) so the chat-side reproduction matches autobuild's environment exactly.

API Changes

None — internal additions only. New shell subcommand autobuild repro_command, new Python module autobuild/repro_command.py, and one dispatcher edit (bin/autobuild). No existing functions, classes, or arguments are modified.
See full details below.

Test Plan

  • pytest tests/test_repro_command.py -q — 7 tests pass (defaults emission, set-override precedence, unset removal, no-match pass-through, script-not-found error, no-workspace-root error, empty env_config)
  • bash bin/autobuild help repro_command — prints the new docstring
  • bash bin/autobuild help — lists repro_command under a new "Triage support" section
  • Smoke against two real failing scripts (autogalaxy_workspace_test/scripts/imaging/visualization.py and autogalaxy_workspace/scripts/guides/results/start_here.py) — env diff matches the workspace env_vars.yaml exactly, including chained substring-matched override unsets (guides/ + guides/results/)
  • Spot-check: ran the emitted Cluster A repro one-liner verbatim, reproduces AssertionError: dataset.png missing matching the recorded report.json failure
Full API Changes (for automation & release notes)

Added

  • autobuild/repro_command.py — new module exposing repro_command(script_path) -> str and canonical_env_for_script(file, env_config) -> dict. The CLI entry point main(argv=None) -> int is invoked by the dispatcher.
  • autobuild repro_command <script_path> — new shell subcommand wired through bin/autobuild under a new Triage support section.

Migration

  • No migration required — additive only.

🤖 Generated with Claude Code

Emits the exact `(cd <ws> && env KEY=val ... python3 <script>)` command
autobuild would have used to run a single workspace script — same defaults
+ per-pattern overrides as `env_config.build_env_for_script`, but starts
from `{}` instead of `os.environ.copy()` so the output is portable across
shells.

Intended for triage handoffs: when pasting a failing script into a chat
or issue, the reader gets a self-contained reproduction that matches
autobuild's environment exactly (PYAUTO_TEST_MODE, PYAUTO_SMALL_DATASETS,
etc.), not just `python3 <file>` which silently omits them.

Wired into the dispatcher under a new "Triage support" section. Verified
end-to-end against the 2026-05-20 release-prep run: spot-check of the
Cluster A `imaging/visualization.py` failure reproduces the recorded
`AssertionError: dataset.png missing` verbatim.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release Merged PR awaiting inclusion in the next release build label May 20, 2026
@Jammy2211 Jammy2211 merged commit b1692d2 into main May 20, 2026
@Jammy2211 Jammy2211 deleted the feature/autobuild-repro-command branch May 20, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release Merged PR awaiting inclusion in the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant