Repository navigation
fix(studio): report why a model's security checks blocked it - #16292
Merged
danielhanchen merged 4 commits intoNov 1, 2026
Merged
Conversation
A check that could not run reached the consent dialog as a CRITICAL finding, and a repo missing from the active source as one with custom code. Both gates now record a block cause, which the dialog and load errors report with the source and next step. On ModelScope, a missing repo with a cached main snapshot is judged by that snapshot, which is what the hub falls back to loading.
[skip ci]
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Nov 1, 2026
Member
|
Review record for #16292, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#649. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
With ModelScope as the model source, a repo with no
.pyfiles and noauto_mapcould show "Custom code blocked ... declares custom Python code ... A security scan flagged CRITICAL issues". No scan had run and nothing was flagged. A direct load would have reported "flagged as None".Root cause
Two separate problems:
max_severityisNone. The gates fail closed correctly, but nothing carried the reason for the block._config_has_auto_mapreturns "unknown" when any optional config cannot be read, and the gate then reportedhas_remote_code=True. On a source 404 this happens even for a cached repo whose config has noauto_map, because the one optional config missing from the cache cannot be confirmed absent.What changed
block_cause:unsafe_files,critical_findings,unscanned_weights,managed_refused,not_on_sourceorunscannable. The scan route reports the strongest one, so a finding always outranks a check that could not run, along with the active source and the missing repo.has_remote_code=False. It stays blocked and non-approvable, and the route still forces the dialog.Behavior change to review closely: cached snapshots on ModelScope
This is the one place a load blocked today can now pass. When ModelScope answers that it has no such repo and the cache holds a main snapshot, both gates evaluate that snapshot instead of blocking.
Measured with
huggingface_hub1.32: on a repo 404,hf_hub_downloadandsnapshot_downloadreturn therefs/maincached files, so a load by repo id reads that snapshot. Judging it inspects what would actually run: code in it still goes through the full scan (a CRITICAL there still hard-blocks), and pickle weights still block asunscanned_weights. Hugging Face is excluded because its 404 can mean private to this caller.Validation
Against the real ModelScope adapter:
no auto_map, cached weights inertnot_on_source,has_remote_code=FalseThe new dialog was checked in a running Unsloth Studio with an absent repo: it shows the source and the switch instruction, with no CRITICAL claim and no enable button. An actual load of the cached repo was not run because it is 187 GB; only its gate decisions were checked.
Mutation checks: 25 of 25 backend and 8 of 8 frontend mutants were caught by the test that owns each guarantee. Four tests in
test_export_ssm_kernels.pyfail on macOS, and the same four fail on unmodifiedmain. The dialog's rendering has no automated test: its test covers the copy selection and that the dialog is wired to it.Before / after
Studio set to ModelScope, loading from the chat model picker a cached repo that exists on no hub (
config.jsonpluspytorch_model.bin, noauto_map, no.py). Merge based6ab4f64aon the left, head77f0afdb2on the right, each a separate install with its own isolated cache.Before, the dialog claims the repo declares custom code and a scan flagged CRITICAL issues (the backend reported
has_remote_code: trueand "Remote code is present (auto_map)"). After, it names the unscanned pickle file and the way forward (has_remote_code: false,block_cause: unscanned_weights). The load stays blocked on both sides.