Skip to content

refactor: propagate shared config via before validator#2517

Draft
mikasenghaas wants to merge 1 commit into
mainfrom
refactor/before-validator-propagation-2
Draft

refactor: propagate shared config via before validator#2517
mikasenghaas wants to merge 1 commit into
mainfrom
refactor/before-validator-propagation-2

Conversation

@mikasenghaas
Copy link
Copy Markdown
Member

Summary

Mirror of #2291, rebased onto main after the monorepo restructure (#2507). Fixes #2430.

Reorganizes 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. This fixes the CLI override bug (#2430): shared fields like --seq-len and --model.name now correctly propagate when combined with a TOML base config.

Root cause: the old mode="after" validators used model_fields_set guards 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. The mode="before" approach operates on raw dicts before sub-configs are constructed, so fill() (write-if-absent) works correctly regardless of how tyro constructs the final instance.

  • Collapses eight per-field after-validators into one validate_shared_configs after-validator
  • Adds validate_shared_seq_len to validation.py
  • Removes RLConfig.max_model_len (declared but never propagated anywhere)
  • Moves auto_setup_session_headers onto OrchestratorConfig (it only touches orchestrator state)
  • Adds focused unit tests covering propagation precedence and CLI merge behavior

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Top-level shared CLI fields (seq_len, max_model_len, model.name) don't propagate when combined with TOML configs

1 participant