refactor: propagate shared config via before validator#2517
Draft
mikasenghaas wants to merge 1 commit into
Draft
refactor: propagate shared config via before validator#2517mikasenghaas wants to merge 1 commit into
mikasenghaas wants to merge 1 commit into
Conversation
Reorganize all shared-config propagation on RLConfig into a single mode="before" validator (auto_setup_shared_configs) so sub-config validators see final values at construction time rather than stale defaults from an earlier validation pass. This fixes the CLI override bug (issue #2430): shared fields like --seq-len and --model.name now correctly propagate when combined with a TOML base config, because the before-validator operates on raw dicts before sub-configs are constructed rather than relying on model_fields_set guards that break when tyro passes pre-built instances. - Collapses eight per-field after-validators into one validate_shared_configs - Adds validate_shared_seq_len to validation.py - Removes RLConfig.max_model_len (declared but never propagated) - Moves auto_setup_session_headers onto OrchestratorConfig - Adds focused unit tests for propagation and CLI merge behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Mirror of #2291, rebased onto main after the monorepo restructure (#2507). Fixes #2430.
Reorganizes all shared-config propagation on
RLConfiginto a singlemode="before"validator (auto_setup_shared_configs), so sub-config validators see final values at construction time. This fixes the CLI override bug (#2430): shared fields like--seq-lenand--model.namenow correctly propagate when combined with a TOML base config.Root cause: the old
mode="after"validators usedmodel_fields_setguards to detect "unset" fields, but after tyro builds a default from TOML and passes it back through Pydantic, those guards treated TOML-derived values as user-set and skipped propagation. Themode="before"approach operates on raw dicts before sub-configs are constructed, sofill()(write-if-absent) works correctly regardless of how tyro constructs the final instance.validate_shared_configsafter-validatorvalidate_shared_seq_lentovalidation.pyRLConfig.max_model_len(declared but never propagated anywhere)auto_setup_session_headersontoOrchestratorConfig(it only touches orchestrator state)🤖 Generated with Claude Code