Repository navigation
feat(unsloth): model-load keystone (#24) — ensure the engine has a model (TDD) - #1712
Merged
Merged
Conversation
…del (TDD)
unsloth Studio starts EMPTY (/v1/models -> []; inference -> "No GGUF model
loaded"), so nothing a persona needs serves until something tells unsloth what
to load. This is that keystone — the reliable-startup piece ("automatic after
the key"), pure delegation over unsloth's HTTP surface (UNSLOTH-INTEGRATION.md
§3.5), never a CLI subprocess.
TDD-first: the decision (loaded? -> skip; empty? -> load; unreachable/failed
-> DEGRADE, never panic) lives in ensure_model_loaded() over the UnslothControl
trait, unit-tested against a fake with zero network — that's the part that must
be reliable. UnslothHttp is the real reqwest impl (GET /v1/models,
POST /api/inference/load), mirroring the endpoints verified live on this box
(manual load + /v1/chat reply already confirmed end-to-end).
Tests (4, all green): already-loaded is a no-op (no reload churn); empty engine
loads the desired model; unreachable engine degrades WITHOUT attempting a load;
failed load degrades with the reason. Degrade-not-panic per #26.
Next: call ensure_model_loaded at startup with the configured model, then the
live persona bringup reasons through the fueled engine.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 21, 2026
The keystone (#1712) gave us ensure_model_loaded over a TDD'd trait; this wires it into boot so the engine is fueled "automatically after the key." unsloth Studio boots EMPTY — /v1/models is [] and any inference returns "No GGUF model loaded" until something loads one. On startup the core now spawns ensure_startup_model(): reads UNSLOTH_MODEL from config and, if set, ensures that model is loaded into the engine. - startup_model_action(Option<String>) -> StartupModelAction is the pure, TDD-tested config decision: set+non-empty -> Ensure(model); unset or blank -> Skip(reason). NO hardcoded default model path — auto-pick from /api/hub/cached-models is a future enhancement, not a baked-in path that's wrong on every box but the author's. - ensure_startup_model() dispatches on it, delegating to ensure_model_loaded over the real HTTP surface, logging the outcome. - Spawned fire-and-forget in main.rs alongside the other boot tasks: boot is never gated on the engine, and it's fully degrade-safe — engine down or load fails -> degrade+log, the substrate stays up on its fallback path, never panics ([[substrate-is-a-good-citizen-on-the-host]] / #26). 4 new unit tests cover the config decision (ensure / skip-no-default / blank-is-unset / trimmed). Existing keystone tests unchanged. Co-authored-by: Claude Opus 4.8 <[email protected]>
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.
unsloth Studio starts empty — nothing serves until a model is loaded. This is the reliable-startup keystone: pure delegation over unsloth's HTTP surface (
GET /v1/models,POST /api/inference/load), never a CLI subprocess.TDD-first: the decision (loaded → skip; empty → load; unreachable/failed → degrade, never panic) lives in
ensure_model_loaded()over theUnslothControltrait, unit-tested against a fake (zero network).UnslothHttpis the real reqwest impl, mirroring endpoints verified live on this box (manual/api/inference/load+/v1/chatreply confirmed end-to-end).Tests (4, green): already-loaded no-op (no reload churn) · empty→load · unreachable→degrade-without-loading · failed-load→degrade-with-reason. Degrade-not-panic (#26).
Next: call it at startup with the configured model → live persona bringup reasons through the fueled engine. Additive (new module behind a trait).