feat(models): reload model discovery from the /models dialog - #3374
Open
joestump-agent wants to merge 1 commit into
Open
feat(models): reload model discovery from the /models dialog#3374joestump-agent wants to merge 1 commit into
joestump-agent wants to merge 1 commit into
Conversation
Local providers (Ollama, LM Studio, llama.cpp, LiteLLM, …) can gain models at runtime — an `ollama pull` mid-session — but discovery only ran at startup, so the new models were invisible until Crush restarted. Add a `ctrl+r` "reload" action to the /models dialog that re-runs model discovery for custom providers and merges any newly found models into the in-memory config, then refreshes the list in place (preserving the active filter) and reports how many models were discovered. The concurrent discovery loop is factored out of configureProviders into a shared helper (discoverProviderModels) so load and reload stay in lockstep; reload forces discovery for every custom provider that hasn't opted out via `discover_models: false`. Discovered models remain ephemeral — recomputed each load/reload, never persisted. Wired through the Workspace interface, so it works in both in-process (AppWorkspace) and client/server (ClientWorkspace, via a new /config/reload-discovery endpoint that refreshes the client's cached config) modes. Assisted-by: Claude Fable 5
joestump-agent
force-pushed
the
upstream/model-reload
branch
from
August 16, 2026 05:57
c05352b to
c12eb50
Compare
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.
Posted by
@joestump-agentat@joestump's direction.What & why
There's currently no way to reload model discovery without restarting Crush. Local providers — Ollama, LM Studio, llama.cpp, LiteLLM, etc. — can gain models at runtime (an
ollama pullmid-session), but discovery only runs at startup, so newly pulled models stay invisible until you quit and relaunch.This adds a
ctrl+r"reload" action to the/modelsdialog that re-runs model discovery for custom providers, merges any newly found models into the in-memory config, refreshes the list in place (preserving whatever you've typed as a filter), and reports how many models turned up.How it works
configureProvidersintodiscoverProviderModels(internal/config/discovery.go) so load-time discovery and interactive reload stay in lockstep. Load keeps its original trigger semantics; reload forces discovery for every custom provider that hasn't opted out viadiscover_models: false.ConfigStore.ReloadModelDiscovery(ctx) (int, error)re-runs discovery (10s timeout), merges results, and returns the count of newly added models. Like startup discovery, results are ephemeral — recomputed each time, never persisted to disk.ctrl+r→ActionReloadModelDiscovery→ background reload → the list rebuilds via a newModels.ReloadItems()that re-applies the active filter. A toast reportsDiscovered N new models/No new models found. The dialog stays open throughout.Workspaceinterface:AppWorkspacecalls the store directly;ClientWorkspaceproxies to a newPOST /v1/workspaces/{id}/config/reload-discoveryendpoint and then refreshes its cached config so the client's dialog sees the new models.Scope
This reloads custom/local provider discovery (the
discoverpackage) — the case where models genuinely appear at runtime. It does not re-fetch the known/catwalk (models.dev) provider list, which is memoized per-process and is a separate concern.Testing
internal/config/discovery_test.go:providerWantsDiscoverytrigger matrix (load vs. force/reload), an end-to-end reload against anhttptestserver whose model list grows between passes (verifies the new model is picked up,addedcount is correct, and user-specified model metadata is preserved), and an opt-out (discover_models: false) test asserting the provider is never queried.internal/ui/dialog/models_test.gocoveringReloadItems()filter preservation.go build ./...,go vet, andgofmtclean;internal/config,discover,ui/dialog,workspace,server, andclientpackage tests pass.💘 Generated with Crush
Assisted-by: Claude Fable 5