Model hub: resolve unlisted Ollama models by exact name - #56
Open
shaun-ws-yap wants to merge 1 commit into
Open
shaun-ws-yap wants to merge 1 commit into
shaun-ws-yap wants to merge 1 commit into
Conversation
The Ollama model hub browses a committed snapshot (desktop/src/electron/model-hub/ollama-models.json) regenerated by hand, so a model published after that snapshot is invisible in the hub even though the engine can pull it. The pull path never had this limit: pull_model forwards whatever name it is given and never consulted the catalog, so the snapshot gated discovery alone. When a search matches nothing locally and the query is a well-formed model reference, resolve that one exact name against registry.ollama.ai and fold the answer into the list as an ordinary result row. The registry speaks the same OCI distribution API ollama pull uses, so this asks the source the engine would ask rather than scraping rendered HTML. It answers 404 for /tags/list, so browsing still comes from the snapshot and this is an exact-name lookup rather than a search. A manifest carries no publication date and the registry sends no last-modified, so ModelEntry.updatedAt becomes optional and a resolved row omits its age rather than claiming it was updated just now. Lookups arrive over IPC, so the reference is validated in the main process rather than trusting the renderer's own check: without it "foo/.." walks out of the namespace and "foo/bar#z" truncates the request path. Refs NVIDIA#21 Signed-off-by: Shaun Y <me@shaunyap.ca>
shaun-ws-yap
force-pushed
the
ollama-hub-exact-name-lookup
branch
from
September 9, 2026 21:25
6c906f9 to
3fefdb1
Compare
shaun-ws-yap
marked this pull request as ready for review
September 9, 2026 21:27
Collaborator
|
@ckelseynv to have a look. We used to scrape the website and don't really want to go back to that. I haven't looked at the code here, so not sure on implementation, but Chris will be able to add context and review this! We do want to find a way moving forward of making sure that we don't get stuck with old model lists. |
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.
Description
Add modelbrowses a catalog PAIR ships with the application —desktop/src/electron/model-hub/ollama-models.json, a committed snapshotregenerated by hand. Anything Ollama publishes after that snapshot is invisible
in the hub even though the engine can pull it, because
pull_modelforwardswhatever name it is given and never consulted the catalog. The snapshot on
mainis dated2026-07-21and holds 232 base models;ollama.com/librarycurrently lists 239.
This makes a search that matches nothing fall back to asking Ollama's registry
about that one exact name, and shows the answer as an ordinary result row.
Selecting it downloads it through the existing path.
registry.ollama.aispeaks the same OCI distribution APIollama pulluses, sothis asks the source the engine would ask, rather than scraping rendered HTML —
the fragility this project deliberately removed when it froze the catalog. The
registry answers 404 for
/tags/list, so a catalog still cannot be enumeratedfrom it; browsing continues to come from the snapshot, and this is an exact-name
lookup rather than a search.
Refs #21, which reports the symptom (
qwen3.8not appearing) and names the samemodel this was verified against.
User-visible change for the release notes: searching the Ollama model hub for
a model published after your PAIR release now finds it, instead of reporting
"No models found".
Scope
In scope
engine:lookup-hub-modelchannel, mirroring the existingengine:search-hub, dispatching per engine.ollama-registry.ts: reads one manifest for the download size, then the configblob it points at for the model's own parameter size, quantization and format.
Bounded cache holding negative results,
AbortSignaltimeout, model referencevalidated in main.
debounced by 400 ms, with a generation guard against races.
ModelEntry.updatedAtbecomes optional. A manifest carries no publication dateand the registry sends no
last-modified, so a resolved row omits its agerather than claiming it was updated just now. The
lastModifiedcomparatorsorts an unknown date oldest instead of returning
NaN.Deliberately out of scope
ollama.comHTML at runtime. Left alone rather than reintroducing that.
behind a release and has no gap to close.
hf.co/<user>/<repo>.registry.ollama.aicannot answer for them, and asking would report a realmodel as missing.
Validation
macOS 26.6, Apple silicon, Node 26.8.1, Ollama running locally.
New coverage:
tests/modular/ollama-registry-lookup.test.ts— size accumulation, configenrichment and its fallback when a config omits
model_type, vision detection,namespace and tag defaulting, 404 and offline handling, caching, and
URL-safety of the parsed reference.
tests/modular/model-hub-lookup.test.ts— which queries are worth a request,including cloud-tag and non-reference rejection and matcher linearity.
Manual, against the live registry:
qwen3.827.3B, visiongemma48.0Bqwen3.5:4bqwen3-vl:235b-cloudRisk
registry.ollama.ai, contacted from the main processonly, only for a name the user typed, and only after a local search returned
nothing. No credentials and no telemetry. This is the part worth an explicit
decision: PAIR is local-first and documents no outbound hosts today.
CONTRIBUTING.mdasks for maintainer alignment on a new model source, which iswhy this is a draft — happy to change the approach or drop it.
parseReferencevalidates every segment and the tag in main against a character class. Without
it
foo/..walks out of the namespace andfoo/bar#ztruncates the requestpath. Covered by a test.
manifest's true byte count.
formatBytesdivides by 1024³ while labelling theresult "GB", so a 17.74 GB model renders as 16.52 GB. Existing rows agree with
ollama.com only because the scraper parses its decimal
"4.9GB"strings asbinary, inflating every stored size by ~6.9%; two errors that cancel. I have
not touched either here — correcting the formatter requires correcting the
snapshot in the same change, and that is its own PR. Happy to open it.
details.familycarries a capability, not a model family. Pre-existing:the scraper puts the capability chip there. Resolved rows follow that
convention so the chip matches sibling rows, which means this PR propagates the
misnomer rather than fixing it.
failure resolves to "no row" rather than an error banner for a request the user
never made. A
console.warnkeeps a broken channel visible in DevTools.no change to
pull_model, no service binary touched — so noservices/versions.jsonbump applies.Checklist
git commit -s), certifying the Developer Certificate of Origin.docs/getting-started.mdxshould describe this before the draft is marked ready; holding until the
approach is settled, since the wording depends on it.
services/versions.json, and described user-visible changes above so they reach the release notes. — no bump applies; desktop-only, no service binary output changed.