fix(external-llm): match Ollama models carrying the default :latest tag - #176
Merged
Conversation
The external-model reuse path normalises both sides of a comparison and
then requires an exact string match. Normalisation translated `:` to `-`
only after stripping quantization suffixes, so anything Ollama put in the
tag position survived into the name.
Ollama's default tag is `latest`. `ollama pull qwen3-30b-a3b` is listed by
/api/tags as `qwen3-30b-a3b:latest`, which normalised to
`qwen3-30b-a3b-latest` and matched the tier target `qwen3-30b-a3b` at
nothing:
qwen3-30b-a3b:latest -> qwen3-30b-a3b-latest NO MATCH
gemma-4-e4b-it:latest -> gemma-4-e4b-it-latest NO MATCH
qwen3.5-2b:q8_0 -> qwen3.5-2b-q8-0 NO MATCH
That is the commonest case there is: the user already has exactly the
model ODS wants, pulled by bare name. Reuse declined it and the installer
downloaded a duplicate multi-GB GGUF — the opposite of what the feature
exists to do. A user who happened to pull with an explicit size tag
(qwen3.5:9b) matched fine, which is why this survived.
Do tag handling before the quantization strip: drop a trailing `:latest`,
then translate the colon so a quantization arriving as a tag is
recognisable to the existing pattern. Size tags still survive as part of
the identity (qwen3.5:9b -> qwen3.5-9b), and `latest` is only ever
stripped as a tag, never from inside a name.
Extends tests/test-external-services.sh with 12 assertions: every tag
shape, the tier-target-to-Ollama-listing matches, and negative cases so a
different size or a different model carrying :latest still does not match.
…ng the default :latest tag
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.
Ports upstream Osmantic#2512: fix(external-llm): match Ollama models carrying the default :latest tag
Original: Osmantic#2512
Auto-ported (v2.6.0+ branch verified), lint-checked (make lint), structural- and legacy-token-checked, by Claude Code.