Repository navigation
feat(unsloth): auto-fuel the engine at startup (#24 wiring) - #1713
Merged
Merged
Conversation
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.
What
Wires the #24 keystone (
ensure_model_loaded, merged in #1712) into corestartup so the engine is fueled automatically after the key — the
"install → it's just running" UX.
unsloth Studio boots EMPTY:
/v1/modelsreturns[]and any inferencereturns "No GGUF model loaded" until something loads one. On startup the core
now spawns
ensure_startup_model(): it readsUNSLOTH_MODELfrom config and,if set, ensures that model is loaded into the engine over unsloth's HTTP
management surface.
How
startup_model_action(Option<String>) -> StartupModelAction— the pure,TDD-tested config decision.
set+non-empty → Ensure(model);unset or blank → Skip(reason). No hardcoded default model path — auto-picking from/api/hub/cached-modelsis a future enhancement, not a baked-in path.ensure_startup_model()— dispatches on the action, delegating toensure_model_loadedover the real HTTP surface (UnslothHttp::from_config),logging the outcome.
main.rs— spawned fire-and-forget alongside the other boot tasks. Bootis 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 (Prepare for Lerna 8 upgrade #26).
Tests
4 new unit tests over the pure config decision:
configured_model_means_ensureunset_model_skips_no_hardcoded_defaultblank_model_is_treated_as_unsetconfigured_model_is_trimmedExisting keystone tests unchanged (8 pass total in
unsloth_control).🤖 Generated with Claude Code