Skip to content

feat: move config blocks to the component that uses them - #4903

Closed
mikasenghaas wants to merge 2 commits into
fix/shared-file-monitorfrom
feat/move-config-blocks
Closed

mikasenghaas wants to merge 2 commits into
fix/shared-file-monitorfrom
feat/move-config-blocks

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Why. After #4899, the top level of prime_rl.configs should hold only blocks that several components share. Three modules break that rule: inference.py holds the engine and router blocks, algorithm.py is read only by the orchestrator, and diff.py is a generic utility, not a config.

Idea. Move each module to the component that uses it. This PR is a pure move: no class, field or default changes.

Before After
prime_rl.configs.inference (server, vLLM, weight broadcast, KV offload, HiSparse, P/D transfer, deployment) prime_rl.configs.components.engine
prime_rl.configs.inference (VllmRouterConfig, LlmdRouterConfig, RouterBackendConfig, KNOWN_SCORERS) prime_rl.configs.components.router
prime_rl.configs.algorithm prime_rl.configs.components.algorithm
prime_rl.configs.diff prime_rl.utils.diff
  • The deployment configs stay in components/engine.py. P/D deployment uses the KV offload configs, and a block may not import a component (test_config_layout).
  • components/engine.py gets an EngineConfig and an engine script in the next PR of the stack.
  • TOML and CLI keys do not change.

Breaking

Python imports of the old module paths fail with ModuleNotFoundError. There are no shims. Migrate with the table above.

Verification

On e49629b, on macOS without torch or tasksets:

  • Schemas. I dumped model_json_schema() of the 9 script configs (rl, sft, pretrain, eval, inference, trainer, orchestrator, router, env worker pool) on this branch and on the base branch. The dumps are byte-identical.
  • Imports. A static check resolves every from prime_rl.… import … in the repo's tracked Python files: 0 unresolved.
  • Unit suite. 663 passed, 149 failed, 110 collection errors in 10 s. The pass/fail/error set is identical to the base branch. All failures and errors are from missing GPU-only packages and tasksets on macOS.

Merge order

Merge after #4899 and #4901. This PR is stacked on #4901 (fix/shared-file-monitor). Squash-merging the base PRs first is safe: rebase this branch onto main after each merge.

🤖 Generated with Claude Code


Note

Low Risk
Refactor-only import and module layout changes with unchanged JSON schemas; risk is limited to external code still importing old paths.

Overview
Reorganizes the config package so shared top-level prime_rl.configs.* only holds blocks used by multiple components. prime_rl.configs.inference is split: vLLM/server/deployment/KV offload live under prime_rl.configs.components.engine, and VllmRouterConfig, LlmdRouterConfig, and RouterBackendConfig move to prime_rl.configs.components.router. prime_rl.configs.algorithm moves to prime_rl.configs.components.algorithm.

prime_rl.configs.diff (Live, Frozen, diff_config, etc.) moves to prime_rl.utils.diff since it is generic runtime utility, not schema.

All Python imports, docs (algorithms.md, training.md), and prime-rl-configs README are updated to the new paths. TOML/CLI keys are unchanged; this is described as a pure move with no field or default changes.

Breaking: imports from the old module paths fail with ModuleNotFoundError — there are no compatibility shims.

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

mikasenghaas and others added 2 commits December 2, 2026 11:22
A shared [monitors.file] block passed only its path down. Its other
settings (trace_sample, live, chunk_bytes, ...) never reached the
trainer or the orchestrator, which kept their defaults without a
warning. Propagate every FileMonitorConfig field.

A resolved rl.json dumps every shared leaf, defaults included, so a
re-load saw those defaults as values that conflict with a component's
own setting. [ckpt] with [orchestrator.ckpt] rollouts = true already
failed to re-load this way, and the file monitor fields would have
too. A shared value equal to its class default now never conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
configs/inference.py splits into components/engine.py and
components/router.py, which now holds the router backend blocks.
configs/algorithm.py moves to components/algorithm.py, and
configs/diff.py moves to utils/diff.py.

The old import paths fail loudly; there are no shims.

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

Copy link
Copy Markdown
Member Author

Folded into #4899: both PRs are pure moves of config modules, so they share one import-path table.

@mikasenghaas
mikasenghaas deleted the feat/move-config-blocks branch December 2, 2026 19:36
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