fix(config): reject non-positive explorer_sync_interval / trainer_sync_interval - #626
Open
Linxiushen wants to merge 1 commit into
Open
Linxiushen wants to merge 1 commit into
Linxiushen wants to merge 1 commit into
Conversation
…sync_interval` SynchronizerConfigValidator asserts that `sync_interval` is positive, but the two per-role overrides that default to it, `explorer_sync_interval` and `trainer_sync_interval`, had no range check. Setting either to 0 passed validation and then crashed later in IntervalConfigValidator with `ZeroDivisionError: integer modulo by zero` (config_validator.py:895), instead of failing with a clear message. Add the same positivity assertions right after the two set_if_none calls, so inherited values are checked as well. Configurations with positive values are unaffected; none of the shipped example configs set these fields.
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.
Problem
SynchronizerConfigValidatorasserts thatsynchronizer.sync_intervalis positive, but the two per-role overrides that default to it,explorer_sync_intervalandtrainer_sync_interval, have no range check. Setting either to0passes that validator and then crashes further down the validator chain:Reachability, stated plainly: the two fields are not mentioned in the docs or in any example config (they are only described in a comment in
config.py), so a user has to know about them from the dataclass. Once used,0is an easy mistake for "sync every step". The consequence is a confusing traceback at config time instead of a clear validation error; there is no wrong numeric result.Fix
Add the same positivity assertions the validator already uses for
sync_interval, placed right after the twoset_if_nonecalls so that inherited values are checked too:Any configuration with positive values is unaffected. I ran all 74 YAML files under
examples/andtests/templatethrough the validator chain before and after the change: outcomes and the resolved interval values are identical (none of them set these fields).Test
test_sync_interval_overrides_must_be_positiveintests/common/config_test.py, one subtest per field. Without the fix both subtests fail with theZeroDivisionErrorabove; with it they pass with the expectedAssertionError.Placed next to
test_multinode_vllm_requires_full_node_occupancyrather than at the end of the class, to avoid a textual conflict with the test that #613 adds at the end.pre-commitpins (black 23.7.0, isort 5.12.0, flake8 6.1.0) pass on both files.This fix was developed with AI assistance (Claude); the change and the test were reviewed and verified locally before submission.