Repository navigation
Studio: fix two first-use regressions from deferred startup hardware detection - #16629
Conversation
…dware detection Before detection the listing reported every known diffusion family as loadable, so a family whose diffusers class is missing and that sd.cpp cannot assemble showed up as an image model and only failed on load. Only the engine prediction needs the device; keep that provisional and apply the class and sd.cpp checks as before. The post-detection contract tests now pin detection complete instead of depending on test order.
…s a non-GGUF cache With startup detection deferred, a chat-only host read as unknown, so autoload tried a cached safetensors repo, got the backend's refusal and stopped before the default GGUF. Ask for detection first when such a candidate exists; a GGUF-only cache stays free of the probe.
…r tests pin an engine Those tests stub predict_engine, which is a post-detection answer; run in a fresh process the listing is still before detection and leaves the engine provisional, so they failed on every staging OS.
…toload picks a candidate On a busy host detection outlasts the health read's single 5 s wait, so autoload still went on with an unmeasured verdict and tried the cached non-GGUF repo. Poll the health read (bounded at 60 s, abortable) until the verdict is measured; past the bound it stays fail-open as before.
…rovisional=True) One predicate for picker and loader: before detection only the device-dependent engine predictions are answered optimistically, the device-free refusals are the router's own, so the listing cannot drift from the load check. [skip ci]
[skip ci]
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98f28d9067
ℹ️ 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".
| async function awaitMeasuredVerdict(signal?: AbortSignal): Promise<void> { | ||
| try { | ||
| await fetchDeviceType({ detectHardware: true }); |
There was a problem hiding this comment.
Bound health reads by the deadline and cancellation signal
If a health request stalls while autoload is measuring a deferred verdict, this await can block indefinitely—even after the user stops the send. fetchDeviceType delegates to readHealth in studio/frontend/src/config/env.ts, whose fetches have neither an abort signal nor a request timeout; its five-second polling window does not bound an individual fetch. The initial request also runs before the 60-second deadline is established, and subsequent requests can overrun that deadline. Bound both health awaits by the remaining time and the caller's cancellation signal so a stalled request cannot leave autoload pending indefinitely.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3514aec: each verdict read now races the remaining deadline and the send's abort signal; harness test stalls /api/health and stops the send.
… send's abort signal [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Follow-up to #16469 (opt-in startup ML warmup). With startup hardware detection now deferred by default, two first-use paths started answering on an unmeasured verdict. This keeps #16469's cold, torch-free idle start and fixes both.
What changes
family is not None). A family whose diffusers pipeline class is missing and that sd.cpp cannot assemble was therefore listed as an image model and only failed on load, which breaks the rule that the picker and the loader agree. Only the engine prediction needs the device. Before detection the listing now calls the samefamily_buildable_herewithprovisional=True, which answers only the device-dependent engine predictions optimistically and keeps every device-free refusal, so the listing and the loader still share one predicate. The load re-checks with the measured verdict. None of these checks imports torch or diffusers or starts detection./api/healthcannot outlive the deadline or a stopped send; past the deadline it stays fail-open as on main).The post-detection listing contract tests in
test_cached_gguf_routes.py(krea2, MOSS-Image, and the old-diffusers picker / loader agreement tests that stub the engine prediction) now pin detection complete instead of depending on test order. Run alone or in a fresh process on current main they fail (13 krea2 / MOSS-Image cases, plus the two old-diffusers tests on every staging OS), because nothing in the file marks detection complete.Results
test_cached_gguf_routes.py -k "krea2_gguf_is_an_image or moss_image_gguf_inventory", run alonetext-to-imageimage-diffusion-unsupported(same as after detection)Tests
test_listing_before_detection_keeps_device_free_refusals: fails on main, passes here; it also fails if the listing callsfamily_buildable_hereorpredict_enginebefore detection.tests/studio/test_chat_autoload_failure_gate.py) gains afetchDeviceTypestub and adetectedChatOnlyscenario field; 4 deferred-verdict scenarios, including detection that lands only after several more health reads (3 fail without the change); the whole file passes, 85 tests.test_cached_gguf_routes.py,test_cold_model_catalog.py,test_selective_ml_warmup.py,test_startup_ml_warmup.py,test_ml_warmup_idle_runtime.py: only failures are a local huggingface_hub / diffusers version mismatch intest_pipeline_class_guard_passes_every_shipped_family(fails on main too) and subprocess timeouts on a heavily loaded host in the startup subprocess tests.tests/studio/test_model_picker_contracts.pypasses.Not covered
Before / after (chat-only CPU host, cache holds only a safetensors repo)
First send with no model loaded, base
b5c1396vs head3514aec, each Studio on an isolated HF cache seeded withtrl-internal-testing/tiny-Qwen3ForCausalLM. Before: autoload tries the cached repo, the backend refuses it and the send stops with an error. After: autoload measures the verdict, skips the repo and starts the default GGUF.