Skip to content

feat(unsloth): auto-fuel the engine at startup (#24 wiring) - #1713

Merged
joelteply merged 1 commit into
canaryfrom
feat/unsloth-startup-autofuel
Jun 21, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/unsloth-startup-autofuel

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

Wires the #24 keystone (ensure_model_loaded, merged in #1712) into core
startup so the engine is fueled automatically after the key — the
"install → it's just running" UX.

unsloth Studio boots EMPTY: /v1/models returns [] and any inference
returns "No GGUF model loaded" until something loads one. On startup the core
now spawns ensure_startup_model(): it reads UNSLOTH_MODEL from 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-models is a future enhancement, not a baked-in path.
  • ensure_startup_model() — dispatches on the action, delegating to
    ensure_model_loaded over the real HTTP surface (UnslothHttp::from_config),
    logging the outcome.
  • main.rs — spawned fire-and-forget 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 (Prepare for Lerna 8 upgrade #26).

Tests

4 new unit tests over the pure config decision:

  • configured_model_means_ensure
  • unset_model_skips_no_hardcoded_default
  • blank_model_is_treated_as_unset
  • configured_model_is_trimmed

Existing keystone tests unchanged (8 pass total in unsloth_control).

🤖 Generated with Claude Code

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]>
@joelteply
joelteply merged commit c265315 into canary Jun 21, 2026
4 checks passed
@joelteply
joelteply deleted the feat/unsloth-startup-autofuel branch June 21, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant