Skip to content

Record the NPU detector's file load in the risky-loader baseline - #18297

Merged
danielhanchen merged 1 commit into
mainfrom
ci/npu-detect-risky-loader-baseline
Nov 18, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/npu-detect-risky-loader-baseline

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Record the NPU detector's file load in the risky-loader baseline

The risky-loader lint in Source lint fails on main since #18049. It shows up on unrelated PRs, for example #17550:

1 risky loader call site(s) not in the baseline:
  unsloth_cli/_npu.py:88  [dynamic-import] spec_from_file_location

Cause

#18049 added npu_detected() to unsloth_cli/_npu.py. The CLI uses it to reuse Studio's stdlib-only NPU detector without importing the Studio backend. It loads the file through importlib.util.spec_from_file_location, which scripts/lint_risky_loaders.py flags until the call site is reviewed and recorded.

Why it is safe

The path is fixed: Path(__file__).resolve().parents[1] / "studio/backend/utils/hardware/npu.py". That is a file shipped in the same package, and no user, network or checkpoint input chooses it. Any failure, including a missing file, is caught and returns False.

So the lint's own guidance applies: record the call site with a reason rather than change the code.

Fix

One new entry in scripts/risky_loaders_baseline.json, generated with python scripts/lint_risky_loaders.py --update. The generated REVIEW ME placeholder is replaced with the reason above. No other entry moves, and no code changes.

Verification

  • python scripts/lint_risky_loaders.py: fails on main on this call site and passes with this change. --self-test passes too.
  • The repo's risky-loader tests pass: 46 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T09:59:49.469906Z bd06372 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: bd06372c62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 36c9f17 into main Nov 18, 2026
@danielhanchen
danielhanchen deleted the ci/npu-detect-risky-loader-baseline branch November 18, 2026 10:01
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