Skip to content

[No.35] feat(doctor): add config doctor and dry-run - #204

Open
AutumnCs wants to merge 5 commits into
redai-infra:mainfrom
AutumnCs:task/35-config-doctor
Open

[No.35] feat(doctor): add config doctor and dry-run#204
AutumnCs wants to merge 5 commits into
redai-infra:mainfrom
AutumnCs:task/35-config-doctor

Conversation

@AutumnCs

@AutumnCs AutumnCs commented Aug 1, 2026

Copy link
Copy Markdown

Task issue: #203

What

Add a CI-friendly Config Doctor and dry-run entrypoint for Task 35:

relax-doctor [doctor options] -- <training arguments>

The command statically resolves training configuration and reports:

  • merged and normalized configuration with conservative field provenance
  • runtime role and placement-group topology
  • GPU requirements and parallel-rank derivation
  • sanitized expected launch command
  • structured diagnostics with stable rule IDs and targeted fixes
  • resolved, partial, or unresolved resolution status

It does not start Ray, Ray Serve, SGLang, CUDA/distributed workers, or a training loop.

Why

Relates to #203 and #86.

Many argument, path, dependency, resource, backend, and algorithm conflicts can be identified before GPU allocation. Doctor, Registry, Controller, and managed-teacher helpers consume the same side-effect-free Launch Plan primitives so the preview follows runtime role and GPU semantics instead of maintaining a Doctor-only topology.

How

  • Reuse the real Relax, Megatron, and SGLang parser stack for deterministic static normalization and backend validation.
  • Preserve the original parser error on fallback; partial output is diagnostic-only and omits authoritative topology, GPU, and rank plans.
  • Reject unknown long/short options, malformed resources, booleans used as integers, zero-GPU model roles, and GPU-assigned CPU-only roles.
  • Derive GRPO/PPO/SFT, debug, Hybrid, fully-async, true-on-policy, GenRM, and managed-teacher plans through shared pure functions.
  • Parse a documented safe Bash subset without executing scripts; unresolved source files, required variables, command substitution, control flow, malformed syntax, or missing training commands fail closed.
  • Support structured config, generalized data paths, text/JSON output, --output, --strict-warnings, and exit codes 0/1/2.
  • Recursively redact key/token/password/secret/credential values from argv, config, runtime env, commands, parser errors, rule failures, text, and JSON.
  • Provide an extensible rule registry, more than 15 error classes, a fixture library, and Chinese/English documentation.

Testing

Environment:

  • Linux, Python 3.12.13
  • rebased onto main@ce650113e01b2c0b1dabbfe3f35cdffd7f3be67d
  • CPU-only static validation; no GPU worker was allocated or started
export PYTHONPATH=/path/to/Relax:/path/to/Megatron-LM

python -m pytest -q tests/doctor tests/core/test_launch_plan.py \
  tests/utils/test_arguments_opd_teacher_colocate.py
# 114 passed

python -m pytest -q tests --tb=short
# 1011 passed, 14 skipped

pre-commit run --all-files
# all hooks passed

npx vitepress build docs
# build complete

python -m compileall -q relax
git diff --check
# passed

Warnings are existing third-party deprecation/capability warnings; no failed test was skipped. GitHub CI should be evaluated again after the rebased commits are pushed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring to share static launch planning
  • Performance improvement
  • CI/CD or build change

Risk & Rollback

  • --script intentionally supports only a safe static subset and fails closed outside that subset.
  • Missing parser dependencies produce a non-success partial report, never a false final configuration.
  • Runtime-facing changes are limited to shared static planning/validation helpers and retain existing compatibility interfaces.
  • Reverting this PR removes the entrypoint and shared planning refactor.

Checklist

  • Diff is limited to Task 35 implementation, tests, fixtures, and documentation
  • Full pre-commit passes
  • Related and full repository tests pass
  • VitePress documentation build passes
  • No datasets, checkpoints, private machine paths, or real credentials are included
  • GitHub CI passes on the latest pushed commits
  • Maintainer review comments are addressed

@AutumnCs
AutumnCs marked this pull request as draft August 1, 2026 11:07
@AutumnCs AutumnCs changed the title feat(doctor): add config doctor and dry-run 〖No.35〗 feat(doctor): add config doctor and dry-run Aug 1, 2026
@AutumnCs AutumnCs changed the title 〖No.35〗 feat(doctor): add config doctor and dry-run [No.35] feat(doctor): add config doctor and dry-run Aug 1, 2026
@AutumnCs
AutumnCs marked this pull request as ready for review August 1, 2026 11:19
@AutumnCs
AutumnCs marked this pull request as draft August 4, 2026 07:01
@AutumnCs
AutumnCs force-pushed the task/35-config-doctor branch from 234a586 to 7346580 Compare August 4, 2026 08:26
@AutumnCs
AutumnCs force-pushed the task/35-config-doctor branch from 50d2c5a to e11fd1b Compare August 4, 2026 14:42
@AutumnCs
AutumnCs marked this pull request as ready for review August 4, 2026 14:51
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