Skip to content

fix(external-llm): match Ollama models carrying the default :latest tag - #176

Merged
azilber merged 2 commits into
mainfrom
port/pr-2512
Aug 10, 2026
Merged

fix(external-llm): match Ollama models carrying the default :latest tag#176
azilber merged 2 commits into
mainfrom
port/pr-2512

Conversation

@azilber

@azilber azilber commented Aug 10, 2026

Copy link
Copy Markdown
Owner

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.

Hoang130203 and others added 2 commits August 7, 2026 11:21
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.
@azilber
azilber merged commit e9b6512 into main Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants