Skip to content

feat: keep config logic inside prime_rl.configs - #4926

Closed
mikasenghaas wants to merge 2 commits into
feat/typed-vllm-fieldsfrom
feat/config-utils
Closed

mikasenghaas wants to merge 2 commits into
feat/typed-vllm-fieldsfrom
feat/config-utils

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Why. The package layout rules (test_config_package_follows_its_rules) cover only prime_rl/configs/. Two modules outside it held config logic:

  • prime_rl/utils/validation.py held propagate_shared_fields, the rl shared-field table (model.name → trainer.model.name, ...). It is the rl entrypoint's logic, but no import rule applied to it.
  • prime_rl/utils/config.py mixed config helpers (dump_resolved_config, default_output_dir, resolve_client_roles) with CLI helpers (cli, the mode checks), plus two unused functions.

Idea. Move config logic into prime_rl.configs, and add a rule that keeps it there:

Before After
prime_rl.utils.validation.propagate_shared_fields prime_rl.configs.entrypoints.rl.propagate_shared_fields
prime_rl.utils.config.dump_resolved_config prime_rl.configs.base.dump_resolved_config
prime_rl.utils.config.default_output_dir prime_rl.configs.base.default_output_dir
prime_rl.utils.config.resolve_client_roles prime_rl.configs.blocks.client.resolve_client_roles
prime_rl.utils.config.rgetattr, rsetattr removed (unused)
  • prime_rl.utils.config keeps cli, MODES, config_files, config_mode, check_mode and find_package_resource.
  • New README rule 6: prime_rl.utils holds helpers that do not know any config and imports nothing from prime_rl.configs. test_config_utils_hold_no_config_logic enforces it.
  • The Slim-install CI check imports the helpers from their new paths.
  • No behavior change.

Breaking

  • Removed import paths (no shims, per the stack's convention): prime_rl.utils.validation, and default_output_dir, dump_resolved_config, resolve_client_roles, rgetattr, rsetattr from prime_rl.utils.config. Migration: import from the paths in the table. Downstream: the prime CLI schema worker (main and fix(train): compile hosted runs with prime-rl's component builders prime#1284) imports only the prime_rl.utils.config module and looks up dump_components / dump_rl_components with getattr, and model-factory-iac main imports none of these names. Neither breaks.

Verification

On 1fb85cb, on macOS without torch or vllm. b75c993 adds only the CI import fix and a formatting fix:

  • Launcher output. I dry-ran the 103 launcher cases. Every written file is byte-identical to feat: type the vLLM args that prime-rl reads #4925 (815e9b0).
  • Imports. For every from prime_rl.configs… import and from prime_rl.utils.config import in the repo, I imported the module and checked that each name exists: 0 missing. This also covers orchestrator.py and eval/online.py, which need triton to import whole.
  • Tests. The config, launch, router, resume, client, dynamo, algorithm, model-source, control, dashboard and parser tests: 976 passed.
Change removed Result
rule 6 (utils/diff.py imports prime_rl.configs.base) test_config_utils_hold_no_config_logic fails: diff.py imports ['prime_rl.configs.base']

Merge order

Stacked on #4925 (#4899 → #4905 → #4909 → #4919 → #4921 → #4922 → #4923 → #4924 → #4925 → this PR).

🤖 Generated with Claude Code


Note

Low Risk
Refactor with import-path breaks for downstream users; runtime config behavior is unchanged per verification and existing propagation tests still cover propagate_shared_fields.

Overview
Moves config-specific logic out of prime_rl.utils into the prime_rl.configs package so layout rules apply everywhere config behavior lives.

Relocated symbols: default_output_dir and dump_resolved_config → prime_rl.configs.base; propagate_shared_fields → prime_rl.configs.entrypoints.rl (module prime_rl.utils.validation removed); resolve_client_roles → prime_rl.configs.blocks.client. Unused rgetattr / rsetattr are dropped from prime_rl.utils.config, which now keeps CLI/mode helpers and find_package_resource only.

Documentation & CI: README rule 6 states utils must not import configs; test_config_utils_hold_no_config_logic enforces it. The slim-install workflow imports the new paths.

Call sites: Imports updated across configs, orchestrator, eval, dashboard, pathing, and tests — no intended behavior change. Breaking: old prime_rl.utils.validation and the moved names on prime_rl.utils.config are gone without shims.

Reviewed by Cursor Bugbot for commit b75c993. Bugbot is set up for automated code reviews on this repo. Configure here.

utils/validation.py held the rl shared-field propagation, and
utils/config.py held config helpers next to the CLI helpers, so the
package layout rules did not cover them. propagate_shared_fields
moves into the rl entrypoint, dump_resolved_config and
default_output_dir into configs.base, and resolve_client_roles into
blocks.client. The unused rgetattr and rsetattr go. A new rule keeps
prime_rl.utils free of config imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1fb85cb. Configure here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikasenghaas
mikasenghaas removed this pull request from stack #4918 December 3, 2026 03:30
@mikasenghaas

Copy link
Copy Markdown
Member Author

Folded into #4919. The config stack is now four PRs, one per motivation: #4899 (public vs internal configs) → #4909 (a complete config per process) → #4919 (package layout) → #4928 (resolve each value in one place).

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.

1 participant