Skip to content

Resolve bare Ollama model names to their :latest tag - #235

Merged
thushan merged 13 commits into
mainfrom
fix/ollama-bare-name-latest
Oct 27, 2026
Merged

thushan merged 13 commits into
mainfrom
fix/ollama-bare-name-latest

Conversation

@thushan

@thushan thushan commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Ollama lists a model pulled without a tag as name:latest, and Ollama itself treats a bare name as name:latest. Olla did exact lookups only, so all-minilm got 404 model_not_found on every route: /olla/ollama/api/*, /v1/*, /olla/anthropic/... and /olla/models/{id}. The v0.0.30 notes for the TEI work already pointed at this fix.

The lookup order is now:

  1. base exact match;
  2. the catalogue's case-insensitive ID or alias match;
  3. on a miss only, the bare name tries name:latest against Ollama-sourced models.

The backend still receives the client's spelling. Stats and model-keyed sticky sessions key on the native name, so both spellings share one row and one key, including alias targets. The lookup only goes one way, name to name:latest, because Ollama always lists models tagged.

Type of change

  • Bug fix
  • Documentation

How was this tested?

New tests:

  • registry/ollama_default_tag_test.go, including the cases mixed-case Ollama vs vLLM, exact catalogue match beats the fallback, and mixed-case canonical name
  • unifier/catalog_store_ollama_tag_test.go
  • domain/model_tag_test.go
  • proxy/core/model_rewrite_test.go
  • handlers/handler_proxy_ollama_default_tag_test.go: the route table over both engines and strict and optimistic modes

68 subtests fail against 1cda972.

A live run on integration/test-october (85f9244) against real Ollama checked:

  • bare all-minilm returns 200 on /olla/ollama/api/embed, /olla/proxy/v1/embeddings and /olla/proxy/api/embed;
  • /olla/models/all-minilm returns 200;
  • there is one stats row for all-minilm:latest;
  • unknown names still 404.

Checklist

  • make ready passes at dc5192a
  • Tests added or updated for the change
  • Documentation updated: concepts/model-routing.md, integrations/backend/ollama.md, api-reference/ollama.md, concepts/model-aliases.md, and the v0.0.30 release notes
  • No new dependencies added

Known limitations. Neither is worse than main, where every bare name 404s.

  • If Ollama lists a model with uppercase letters (FOO:latest), foo and foo:latest record separate stats rows and sticky keys.
  • Two names with the same digest on one Ollama host (for example after ollama cp) can leave GET /olla/models/foo returning 404. Requests still route.

prefix_hash sticky keys hash the raw body, so they still differ between spellings. That behaviour predates this PR.

Commit history: fcbab95, 60d2094 and 349502d are cherry-picks that only pass make ready with c1f3028. Review the branch as a unit, or squash it.

Summary by CodeRabbit

  • New Features
    • Untagged Ollama model names now resolve to the matching :latest model when no exact name is available. Exact matches take precedence, and this fallback applies only to Ollama models.
    • Requests continue to be forwarded with the model name provided. Bare and tagged names share model-based statistics and sticky-session behaviour.
  • Documentation
    • Updated Ollama API, integration, routing and troubleshooting guidance to explain default-tag resolution and its limits.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The change adds Ollama-only resolution from an untagged model name to its :latest model when no exact match exists. Proxy routes preserve the requested name upstream and use the canonical name for statistics and sticky-session keys. Documentation and tests cover the resolution rules and affected routes.

Changes

Ollama model resolution

Layer / File(s) Summary
Platform-aware catalogue matching
internal/core/domain/model_tag.go, internal/core/domain/unified_model.go, internal/adapter/unifier/*
Source endpoints now record their platform. Catalogue lookup checks exact names before applying the Ollama-only :latest fallback.
Registry fallback and endpoint lifecycle
internal/adapter/registry/*, internal/adapter/discovery/service.go, internal/adapter/inspector/body_inspector.go
Registries resolve bare names to Ollama :latest models after exact matches. Endpoint-aware registration records platform information. Endpoint removal clears related Ollama tracking and cached bare-name lookups.
Canonical names in proxy context and documentation
internal/adapter/proxy/core/model_rewrite.go, internal/app/handlers/*, internal/core/constants/context.go, docs/content/...
Proxy handlers preserve the requested model name for upstream requests and use canonical names for statistics and sticky-session keys. Tests cover routes, aliases and proxy engines. Documentation describes the fallback rules.

Priority: Not assessed

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProxyHandler
  participant UnifiedMemoryModelRegistry
  participant OllamaEndpoint
  participant Stats
  Client->>ProxyHandler: Send request with bare model name
  ProxyHandler->>UnifiedMemoryModelRegistry: Resolve model and canonical name
  UnifiedMemoryModelRegistry-->>ProxyHandler: Return Ollama endpoint and :latest name
  ProxyHandler->>OllamaEndpoint: Forward request with original model name
  ProxyHandler->>Stats: Record request under canonical model name
Loading

Possibly related PRs

  • thushan/olla#231: Adds TEI model discovery to the unified registry; this change adds platform-specific resolution in the same registry data flow.
  • thushan/olla#233: Changes unified-registry publication and endpoint removal, which this change also updates for cached bare-name lookups.

Suggested reviewers: dnnspaul

Merge Risk: Low · up to ad081

The release note could be clearer, but no material behavior issue is established. The change remains mergeable with an editorial follow-up.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…latest

# Conflicts:
#	docs/content/about/release-notes.md
#	internal/adapter/registry/unified_memory_registry.go
#	internal/adapter/unifier/catalog_store.go
@thushan
thushan merged commit e95ca65 into main Oct 27, 2026
7 of 8 checks passed
@thushan
thushan deleted the fix/ollama-bare-name-latest branch October 27, 2026 08:18
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.

1 participant