Skip to content

fix(miles-pipeline): narrow startup-validation import guard to ModuleNotFoundError#32

Open
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/miles-mvp-e2efrom
TianyeGGBond:tianye/f10-import-fail-fast
Open

fix(miles-pipeline): narrow startup-validation import guard to ModuleNotFoundError#32
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/miles-mvp-e2efrom
TianyeGGBond:tianye/f10-import-fail-fast

Conversation

@TianyeGGBond

Copy link
Copy Markdown
Collaborator

Context

MilesPipeline._validate_topology() runs the F10 startup topology validation before any GPU allocation, so a misconfigured run fails fast with a clear message instead of OOM-ing mid-init.

It imports the validator lazily and wraps the import in a guard so a machine without miles installed (test/dev fixtures) can still construct the pipeline:

try:
    from miles.utils.rlix_validation import assert_rlix_topology
except Exception as exc:  # noqa: BLE001
    logger.warning("... unavailable; skipping startup validation ...")
    return

Problem

except Exception is too broad. It catches any failure while importing the validator — not just "miles not installed" (ModuleNotFoundError), but also SyntaxError, AttributeError, or a broken transitive import inside rlix_validation itself (ImportError). In all those cases the code logs a warning and silently skips every C1–C23 check, which defeats the whole point of the fail-fast guard: a real bug in the validator would let a misconfigured topology through to a mid-init OOM.

In production miles is always importable, so the only legitimate skip reason is ModuleNotFoundError (package genuinely absent). Anything else is a real bug and should propagate. This also matches the existing narrow pattern in coordinator.py (except ModuleNotFoundError on dynamic pipeline_cls import).

Change

  • Narrow the guard from except Exception to except ModuleNotFoundError.
  • Drop the now-unnecessary # noqa: BLE001 (no longer a blind except).
  • Tighten the log message.

ImportError / SyntaxError now propagate and fail fast; the miles_args is None test-fixture path (a few lines up) is unaffected.

🤖 Generated with Claude Code

…NotFoundError

The F10 topology validation import was wrapped in `except Exception`, which
skipped all validation on any import error and defeated the fail-fast intent.

Co-Authored-By: Claude Opus 4.8 <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.

1 participant