Run the launch script snapshot tests by hand instead of in CI - #2279
Merged
Conversation
fzyzcjy
force-pushed
the
tom/refactor-miles/op8-18
branch
from
August 8, 2026 06:36
d0682a5 to
c95064e
Compare
fzyzcjy
requested review from
Shi-Dong,
Zhichenzzz,
guapisolo,
jybsuper,
maocheng23 and
yueming-yuan
as code owners
August 8, 2026 06:36
fzyzcjy
force-pushed
the
tom/refactor-miles/op8-20
branch
from
August 8, 2026 06:36
88d197b to
3877d02
Compare
Squashed from: - Fix PYTHONBUFFERED typo in launch scripts and command utils - Fix the same typo in the NPU docker patch - Unbuffer the ray workers, not only the submitting client - Unbuffer the launchers that submit ray jobs of their own
Squashed from: - Add a shell launch script test harness - Make the shell harness report stderr and emit shim stdout correctly - Drop the deprecated huggingface-cli shim - Exercise the shim behaviours the single real script never reaches - Poll the ray cluster the way the real scripts do in the synthetic script - Group the harness tests by what they exercise - Make the harness record commands in fork order and refuse to be unfrozen
…r paths Squashed from: - Fix launch scripts whose model config path could never resolve - Fix two launcher entrypoints that raised before issuing any command - Cover the two regressions this op fixes
… scripts Squashed from: - Derive the miles checkout location instead of hardcoding it - Quote the derived train.py path and pin the invariant - Find the shell scripts without shelling out to git
Squashed from: - Snapshot the external commands of every shell launch script - Apply isort and black to the shell launch script test - Intercept ps so the recordings do not read the host process list - Harden the harness against host state the rollout exposed - Share the snapshot compare-or-update step and stop running each script twice - Keep the generated snapshots under one obvious tests/snapshots tree - Group the launch script tests by subject - Name the shell launcher test after what it covers - Assert the recorded order for every script, including the concurrent ones - Regenerate the concurrent launcher's snapshot in its true command order
ExecuteTrainConfig.num_nodes read SLURM_JOB_NUM_NODES into a class-level
default, so the value was fixed when command_utils was imported. A test that
wants a deterministic launch command cannot undo that with monkeypatch, and a
process that sets the variable after import does not see it either.
A default_factory reads it at construction instead, but dataclass_cli copied
the parameter's declared default straight into the click signature, and for a
factory field that default is dataclasses' _HAS_DEFAULT_FACTORY sentinel,
which click then type-casts:
TypeError: int() argument must be ... not '_HAS_DEFAULT_FACTORY_CLASS'
Every scripts/run_*.py exposes this config through that bridge. Resolve the
factory when the signature is built, the way the argparse bridge already does.
…ript Squashed from: - Snapshot the commands built by every python launch script - Apply isort and black to the python launch script test - Reuse the shell harness sanitizer and snapshot helper - Move the python launcher snapshots into the shared tree too - Share the command recorder with the command_utils tests - Freeze the launcher environment that the snapshots actually depend on - Regenerate the launcher snapshots for the ray runtime unbuffering - Snapshot the config files a launcher generates, not just its commands - Record the generated precision config in the deepseek-v4 snapshots
Squashed from: - Cover the public surface of command_utils with unit tests - Group the command_utils tests by the function under test - Close the gaps that let the command_utils tests pass on broken behaviour - Keep the command_utils tests in one file
Squashed from: - Rename exec_command by the resource its command needs - Point the nvlink and single-node conversion tests at the gpu helper - Re-record the multi-node label the rename changed - Rename the last two exec_command call sites the split missed - Re-record the multi-node label in the rsync_simple test too
Squashed from: - Move the shell exec helpers next to their only consumers - Carry NodeAffinitySchedulingStrategy along with the moved exec helpers - Stop patching command helpers on a module that no longer has them
…yloads Squashed from: - Accept inline base64 payloads for the config file arguments - Pass config documents inline instead of through a temp file - Make the inline config payload reach every consumer and fail loudly - Apply pre-commit import ordering - Regenerate the deepseek-v4 snapshots for the inline config payload
Squashed from: - Snapshot the launchers that build their own command line - Record what the self-executing launchers submit today - Freeze the pid these launchers embed in their cleanup command
…ures Squashed from: - Let a p2p profile's rotary_base reach the model script it configures - Test the model args command run.py actually builds, not a copy of its logic - Flip the p2p snapshots to the rotary base each profile declares
The next ops rewrite all 62 scripts/models/*.sh into python. Once the shell versions are gone there is no source of truth left to prove the rewrite was faithful, so record the argv each of them expands to now. What these golden files pin is agreement with the shell era, not merely agreement with today's behaviour; the rewrite may only change the producer, never these files. They also give the 18 models that no launcher snapshot reaches their first coverage of any kind.
Squashed from: - Expand the model args in python before building the command - Update the launcher snapshots for the inlined model args - Point the command_utils tests at the expanded model args - Freeze the model-args knobs the snapshots now depend on - Skip non-files when scanning the model scripts for environment knobs
Squashed from: - Replace the model config shell scripts with python - Point the run_megatron CLI tests at the model args loader - Preserve the rotary base override in the 16-node profile launcher - Convert the shell model configs to python and load them through one CLI - Apply pre-commit formatting - Keep the environment overrides and the failure path the sourced scripts had - Point the NPU docker patch at the python model definitions - Read each model's environment override where the shell script read it - Match the shell mask when the model is shorter than its dense prefix - Require keyword arguments for the moe layer frequency - Take the model args overrides from the environment the shell already used - Run the model args loader itself instead of a script that only forwards to it - Let the model scripts be plain lists and read their environment at call time - Group the model args utilities by what calls them - Regenerate the shell launcher snapshots for the model args entry point - Expect the TypeError an unknown model args keyword now raises - Drop the override argument the restored environment reading made redundant - Let a model script declare its arguments as one block of text - Concatenate the model argument lines instead of parsing them - Fix the callers that still joined the model args, and pin the contract - Repair the two paths the model args conversion left behind - Treat an explicit zero override as a value, not as a missing argument - Let a model script reach the loader without importing the miles package - Take the golden model args from the python loader instead of the shell - Record the model args lookup in the two concurrent launchers' snapshots - Point the p2p launcher at the loader and let it fail loudly - Regenerate the self-executing launcher snapshots for the python model args
Squashed from: - Quote the model args miles inlines into the launch command - Regenerate the launcher snapshots with the model args quoted - Quote the model args on the NPU path too - Quote the model args the formal-math launcher inlines too - Keep the quoting next to the loader it quotes
The CI runner discovers tests under tests/fast, tests/fast-gpu, tests/e2e and tests/ci (_DISCOVERY_ROOTS in tests/ci/ci_register.py), and everything under tests/fast is registered implicitly by location. Moving the four snapshot tests to tests/manual/launch_scripts takes them out of that set without disabling them: they still run, just only when invoked by hand. The harness modules stay in tests/fast/launch_scripts, so the harness self-test and the shell script hygiene checks keep running in CI, and the moved tests keep importing them by their existing absolute paths.
fzyzcjy
force-pushed
the
tom/refactor-miles/op8-18
branch
from
August 9, 2026 10:00
c95064e to
79e9a3c
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op8-20
branch
from
August 9, 2026 10:00
3877d02 to
4e8f20f
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op8-20
branch
from
August 9, 2026 10:59
793bb01 to
c8e68bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ci-megatron-pr: tom/refactor-miles-repo-megatron/op8-13
The CI runner discovers tests under
tests/fast,tests/fast-gpu,tests/e2eandtests/ci(_DISCOVERY_ROOTSintests/ci/ci_register.py), and everything undertests/fastis registered implicitly by location. Moving the four snapshot tests totests/manual/launch_scriptstakes them out of that set without disabling them: they still run, just only when invoked by hand.test_model_args.py,test_py_launch_scripts.py,test_self_executing_launchers.py,test_sh_launch_scripts.pymove totests/manual/launch_scripts/.sh_harness.py,py_harness.py,model_args_harness.py) stay intests/fast/launch_scripts, so the harness self-test and the shell script hygiene checks keep running in CI, and the moved tests keep importing them by their existing absolute paths.tests/snapshots/README.mdis updated to the new paths, and gains the two rows it was missing (launch_scripts/self_executing/,model_args/).Verified:
discover_ci_files()now returns onlytest_sh_harness.pyandtest_shell_script_hygiene.pyunderlaunch_scripts.pytest tests/manual/launch_scripts-> 495 passed.pytest tests/fast/launch_scripts-> 39 passed.pytest tests/ci-> 319 passed, 1 skipped.