Repository navigation
Studio: keep the last used model when its auto-load fails, and say why another model loaded - #18106
Conversation
Codex Review Summary: ✅ CompletedThis 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 |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
…ne as benign (red since #18103) (#18114) `tests/studio/test_backend_ci_parallel_isolation.py::test_every_tight_elapsed_bound_is_isolated` fails on main (workflow-trigger lint, "Workflow guard suites"), seen on the staging runs of #18077 and #18106: ``` E assert not {'test_anthropic_admission.py': ['test_anthropic_admission.py:239 one duration against another']} ``` ## Cause #18103 replaced the fixed 0.1 s sleeps in `test_anthropic_admission.py` with `_until_queued`, which polls the admission queue with `assert loop.time() < deadline` as a 5 s timeout. The lint flags any clock comparison in a backend test that runs under `-n 4` until a human records it. This one is a poll deadline: descheduling only delays the poll and cannot make the condition false, which is exactly the case `BENIGN_TIMING` is for. #18103 should have recorded it; this does. ## Fix Add `("test_anthropic_admission.py", "_until_queued")` to `BENIGN_TIMING` with a one-line reason, next to the other poll deadlines. ## Verification - main: `test_every_tight_elapsed_bound_is_isolated` fails with the CI message. - this branch: `tests/studio/test_backend_ci_parallel_isolation.py` 43 passed.
…re (intermittent Broken pipe) (#18115) `tests/test_tp_host_input_embedding_gloo.py::test_tp_narrower_than_world_keeps_the_embedding` (added in #18068) fails intermittently in the `Repo tests (CPU, gloo-tp-env)` shard, seen on the staging run of #18106 (a frontend-only PR): ``` [rank1] TCPStore.cpp:106 sendBytes failed ...: Broken pipe File "tests/test_tp_host_input_embedding_gloo.py", line 107, in _case_world_wider_than_tp mesh = init_device_mesh("cpu", (world, 1), mesh_dim_names = ("dp", "tp")) torch.distributed.DistNetworkError: Broken pipe E AssertionError: rank exit codes [0, 1] ``` ## Cause In the `dp_x_tp` case each rank builds a `(world, 1)` mesh, so its `tp` group has one member and rank 0 never waits for rank 1. Rank 0 hosts the TCPStore, finishes, destroys its process group and exits. If rank 1 is still creating its mesh groups through that store, its next store write hits a closed socket. The TP code is fine; the test worker let rank 0 leave first. ## Fix The worker calls `dist.barrier()` after a case has saved its result, before `destroy_process_group()`, so no rank tears the store down while another still uses it. On a failure path nothing changes. ## Verification - Rank 1 delayed by 3 s before `init_device_mesh` (local only, not committed): - main: `rank exit codes [0, 1]` with the same `Broken pipe` as CI. - this branch: passes. - Whole file: 5 passed.
…the kept record, keep the 5 s toast
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
… keep the hf_cache repo id match [skip ci]
… its HF cache path (#18104) Follow-up to #18106 for #18002. ## What was wrong When you press Send with no model loaded, Studio auto-loads your last used model first. #18106 made a failed load of that model show a warning and keep it remembered. One case still slipped past it: when the managed cache listings fail, the cascade falls back to `/api/models/local`, and there a model in another Hugging Face cache (for example the default `~/.cache/huggingface` next to a custom Studio cache) is listed by its snapshot path. The remembered repo id did not match that row, so the model was not tried first, the smallest model on disk loaded with a plain success toast, and its snapshot path replaced the remembered model. That is the original #18002 symptom again. The toasts also named both models by their full snapshot path. ## What changed - `AutoLoadSource` carries the Hub repo id (`model_id`) of `hf_cache` rows. A row matching the remembered model by id or load id still ranks first; a snapshot matching it only by repo id ranks right after, ahead of every other model. Rows from other sources (models folder, LM Studio, ...) match on their own id or load id only. - Auto-load toasts name such a snapshot by its repo id (`Loaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M)`) instead of its snapshot path. - The first version of this PR also stopped the cascade after the last used model failed. That is superseded by #18106 (fallback with a warning) and conflicted with it, so it is removed. ## Testing - `tests/studio/test_chat_autoload_failure_gate.py` runs the real auto-load cascade: - `test_a_failed_last_used_model_in_another_cache_is_still_named_and_kept`: cached listings down, two other-cache snapshots, the last used 26B fails to load. main loads only `gemma-4-E2B-it-GGUF` (the 26B is never tried); this PR tries the 26B, falls back to E2B with `Your last used model unsloth/gemma-4-26B-A4B-it-GGUF (UD-Q4_K_XL) did not load: ...`, and records nothing. - `test_an_exact_last_used_row_outranks_a_snapshot_matched_by_repo_id`: the remembered `Q8_0` row still loads ahead of a smaller snapshot of the same repo that only has `Q4_K_M`. - The whole file passes (91 tests). - `studio/frontend/tests/auto-load-target-key.test.ts` ranking check fails on main and passes here; all `auto-load-*`, `last-local-model-load` and `queued-model-lifecycle` tests pass (55), `scripts/typecheck.mjs` is clean, biome reports the same findings as main. - Two real Studios (merge base vs this PR), CPU, GGUF only: `unsloth/SmolLM2-135M-Instruct-GGUF` and `unsloth/Qwen3-0.6B-GGUF` in a non-active HF cache, Qwen's GGUF header corrupted, last used model set to `unsloth/Qwen3-0.6B-GGUF` (Q4_K_M), the two managed listing requests failed in the browser, then New chat + Send: | | merge base | this PR | |---|---|---| | `/api/inference/load` | SmolLM2 only | Qwen3-0.6B, then SmolLM2 | | Toast | success, snapshot path | warning: `Loaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M)` + `Your last used model unsloth/Qwen3-0.6B-GGUF (Q4_K_M) did not load: ...` | | Last used model after | SmolLM2 snapshot path | `unsloth/Qwen3-0.6B-GGUF` |  *Last used model in another HF cache with a corrupted GGUF and the managed listings failing, then Send with nothing loaded. Before: plain success for the stand-in, named by its snapshot path, and the stand-in becomes the last used model. After: a warning naming the last used model and why it did not load; it stays remembered.* --------- Co-authored-by: Daniel Han <[email protected]>
Fixes #18002
When you press Send with no model loaded, Studio auto-loads your last used model first. If that load fails, for example because llama-server cannot start it, the remaining models on disk are tried smallest first. Today that fallback is silent: the toast just says
Loaded <small model>, and the fallback also replaces the remembered model. The next Send then loads the small model again, which looks like Studio forgot the model you use. This is the "forcing a small Gemma E2B model" part of the report.This PR keeps the fallback, so the message still gets an answer, and changes two things:
Your last used model <id> (<quant>) did not load: <reason>.Nothing changes when the last used model loads, when there is no remembered model, or when the remembered quant is gone from disk (then the next quant still loads and is remembered, as before).
The logic is unchanged in v0.1.917-beta, v0.1.918-beta and main, so this is not a 918 regression. 918 is where the reporter's remembered load started failing.
Tests:
studio/frontend/tests/auto-load-remembered-fallback.test.ts: note wording, warning severity, case-insensitive quant match, and that every auto-load record site is gated (fails on main).tests/studio/test_chat_autoload_failure_gate.pyruns the real auto-load cascade in node: a failed last used model is tried first, the fallback warns and records nothing (fails on main); controls show a healthy last used model and a fallback with nothing remembered are recorded as before. The 21 chat test files intests/studio: 715 passed (main 712).npm test(16476 tests) andscripts/typecheck.mjspass.Checked on two GGUF-only CPU Studios (merge base
c0ef23bcebvs this branch, separate homes and HF caches). Qwen3-0.6B Q4_K_M was loaded through the picker so it became the last used model, then unloaded, its GGUF header corrupted, then New chat + Send:Loaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M)(success)Loaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M):Your last used model unsloth/Qwen3-0.6B-GGUF (Q4_K_M) did not load: Failed to load model: llama-server failed to start. ...unsloth/SmolLM2-135M-Instruct-GGUFunsloth/Qwen3-0.6B-GGUF(Q4_K_M)load 500,load 200,PUT last-local-model 200load 500,load 200, no PUTWith the Qwen file restored, the next Send on this branch shows
Loading last used model… unsloth/Qwen3-0.6B-GGUF (Q4_K_M)and loads it.Remembered model's GGUF corrupted, then Send with nothing loaded. Before: plain success for the stand-in. After: a warning that names the last used model and why it did not load.