Repository navigation
feat: validate each built config once with all its values - #4923
Closed
mikasenghaas wants to merge 1 commit into
Closed
mikasenghaas wants to merge 1 commit into
mikasenghaas wants to merge 1 commit into
Conversation
The builders patched engines and routers after validation: P/D role ports, DP sizes, env vars and vLLM overrides, the admin-token flag, and the router's bidirectional TTL. model_copy(update=...) also changed train samplings without validation. A P/D override such as max-lora-rank = 24 thus reached the engine unrounded, and LoRA did not pin api_server_count to 1. Compute every value first and validate once: the role builder and engine_config(require_admin_token=...) pass the values into build_component_config, router_config passes the TTL, and copy_validated replaces model_copy. Reloading a built engine or router now changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
Member
Author
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
Why.
BaseConfighas novalidate_assignment, so a value set after validation skips every validator. The builders did that to the configs they had just validated:InferenceSection.engine_config(role=…)built an engine, then set the role's port, DP sizes and env vars, andsetattrthe role's vLLM overrides.RLConfig.engine_configs()andSupervisedConfig.engine_configs()setserver.require_admin_tokenon the built engines.InferenceSection.router_config()setpd_bidirectional_ttl_son the built router.model_copy(update=…)changed train samplings (score-centering logprobs, the truncated-samplingtop_kdefault) without validation.So a P/D override reached the engine as written. With
prefill_vllm_overrides = {enable_lora = true, max-lora-rank = 24}, the prefill engine gotmax_lora_rank = 24, which vLLM rejects (the validator rounds it to 32). It also gotapi_server_count = 8, but LoRA needs exactly 1.Idea. Compute every value first, then validate once. The builders pass the role and launch values into
build_component_config:engine_configandengine_configstakerequire_admin_token.router_configtakes the TTL as a field of the build.copy_validated(config, **update)inprime_rl.configs.basereplacesmodel_copy(update=…).RLConfig.auto_setup_deployment). The builders validate those values again when they build the components. The next PR moves the sizing into one function.Breaking
InferenceSection.engine_configtakesrequire_admin_tokenas its second positional argument, beforerole. A caller that passesroleby position must pass it by keyword. All callers in the repo passrole=.Verification
On 99c0d44, on macOS without torch or vllm:
test_engines_and_routers_are_built_wholebuilds every entrypoint case and reloads each engine and router JSON, which must not change. On feat: derive config defaults from values, not from fields_set #4922 the P/D prefill-override case fails: the engine holdsmax_lora_rank = 24andapi_server_count = 8, and a reload gives 32 and 1.setattrafter it)test_engines_and_routers_are_built_whole[rl-pd-prefill-overrides]andtest_pd_role_overrides_pass_the_vllm_validatorsfail-1)test_engines_and_routers_are_built_whole[rl-pd-bidirectional]fails. A valid TTL set after the build would pass: the test catches values a validator changes or rejects.Merge order
Stacked on #4922 (#4899 → #4905 → #4909 → #4919 → #4921 → #4922 → this PR).
🤖 Generated with Claude Code
Note
Medium Risk
Changes how inference engine and router JSON is produced for RL/SFT launches; behavior is intended to match prior output except where validators now correct invalid overrides (e.g. P/D vLLM settings).
Overview
Adds
copy_validatedso copies with field updates re-run Pydantic validators (replacingmodel_copy(update=…)for train sampling defaults, score-centering logprobs, and frozen train-group updates).Engine and router builders no longer mutate configs after
build_component_config. Role-specific P/D values (serverport,vllmoverrides, env vars,require_admin_token, router TTL) are assembled into wired dicts and validated in a single build—fixing cases where post-buildsetattrleft invalid values (e.g.max_lora_rank/api_server_counton prefill LoRA overrides).RL/SFT entrypoints pass
require_admin_token=Trueintoengine_configsinstead of patchingengine.serverafterward.New tests assert each built
EngineConfig/RouterConfiground-trips throughmodel_validateunchanged.Reviewed by Cursor Bugbot for commit 99c0d44. Bugbot is set up for automated code reviews on this repo. Configure here.