Addresses remaining round-30 reviewer findings against PR #5754
(diffusion image generation in Unsloth Studio). The studio.txt /
constraints.txt / colab-new hub-bump items (round 30 #1-#3) are
intentionally skipped: the live B200 Studio install path with
huggingface_hub==0.36.2, transformers==4.57.6 and diffusers==0.37.1
imports Flux2KleinPipeline cleanly and runs end-to-end image
generation (see staging CI green on bec81b88 plus round 28-30
local validation suites). The is_offline_mode ImportError the
reviewer cites only triggers with transformers 5.x against
huggingface_hub 0.x; the constraints pin holds transformers at 4.x
so the combo never materialises on the standard install path.
Concurrency: close the helper / advisor GPU-start race in all four
public load paths (round 30 P1 #7-#10).
* Add a _PUBLIC_LOAD_PENDING_COUNT counter in
utils/datasets/llm_assist.py, published under
_HELPER_ADVISOR_START_LOCK by _raise_if_helper_advisor_busy and
cleared by a paired _clear_public_load_window in
routes/inference.py. A concurrent helper / advisor start now
sees public_load_pending() inside _gpu_workload_busy_for_helper
and refuses VRAM until the public load attempt finishes,
closing the window between the busy snapshot and the public
load flipping its public ownership flags (is_loaded,
current_checkpoint, is_training_active, etc.).
* Wire the paired clear into all five call sites (GGUF chat,
safetensors chat, diffusion image load, training start, export
load-checkpoint). The chat path tracks the published tag in a
local so the finally clears the same counter on either branch
or on early HTTPException.
Security: gate /api/inference/images/load against arbitrary
local-path probes (round 30 P1 #4). Mirror the chat
/api/inference/load native_path_lease boundary so an authenticated
session cannot use repo_id or base_repo as a directory probe.
* Add native_path_lease + base_repo_native_path_lease to
DiffusionLoadRequest (optional; Hub ids skip the lease).
* Add _looks_like_local_diffusion_path + a
_resolve_diffusion_repo_for_request helper that requires a
verified directory-typed native path grant for any value that
starts with /, ~, ./, ../, contains a backslash, or expands to
an absolute path. The detector deliberately avoids Path.exists
so the route does not side-channel filesystem layout via
differential error messages.
Frontend: split the Images page status fetch from the spinner
toggle (round 30 P2 #12). The mount effect and the is_loading
auto-poll now call a setState-free fetchAndUpdateStatus; the
user-driven Refresh button still calls refreshStatus to flip the
spinner. Cleaner separation than the queueMicrotask shim from the
prior commit; the eslint react-hooks/set-state-in-effect rule is
not in the studio-frontend-ci typecheck gate, and the codebase
already has hundreds of pre-existing violations of the same rule.
98 targeted backend tests pass (test_diffusion_routes,
test_diffusion_backend, test_inference_model_validation,
test_models_get_model_config_case_resolution, test_data_recipe_seed,
test_training_raw_support, test_export_log_cursor). Frontend
typecheck passes.