Skip to content

fix(models): route tagged ollama names that share a cloud prefix to ollama - #10351

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/ollama-cloud-named-models
Nov 23, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/ollama-cloud-named-models

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A locally installed Ollama model whose name shares a cloud prefix (gpt-oss:20b, mistral:latest) was sent to that cloud provider at execution. The editor showed it as Ollama, because the browser registers the installed list. The server never does, so findProviderFromModel fell through to the provider patterns (/^gpt/, /^mistral/, …) and resolved OpenAI or Mistral. The run then failed with an auth error, or made a billed call with the user's key

  • Ollama lists every installed model with its tag (name:tag), and the dropdown stores that name, while no cloud id a pattern claims carries one. So after the namespace and exact-id steps, a bare tagged name is now left unclaimed, and getProviderFromModel runs it on Ollama like every other local model. It's a synchronous check: no network lookup, and hosted is unaffected

  • Catalog and namespaced ids still win first: bedrock/…:0, openrouter/…:free, ollama/<name> and untagged cloud ids resolve as before

  • getModelCapabilities now falls back to findProviderFromModel instead of its own copy of the pattern scan, so the two can't disagree

  • The Ollama name rule is defined once (OLLAMA_MODEL_NAME in providers/models.ts) and shared with the editing validator

  • Behaviour notes for these names:

    • provider allowlists now judge them as Ollama at execution;
    • they get no cloud capabilities (e.g. forced tool use);
    • stored fallback rows with these names stop being offered, as for any other local model.

    Each of these previously led to a call against the wrong provider.

  • Not covered: a hand-typed untagged name (mistral) is genuinely ambiguous and still resolves to Mistral; ollama/mistral is the explicit form

Type of Change

  • Bug fix

Testing

  • tools/llm/chat.test.ts: through the real execution input path on the server, with no registered Ollama list, gpt-oss:20b, mistral:latest, claude-local:7b and a namespaced tagged name resolve to ollama. These fail on the previous code
  • providers/models.test.ts: tagged names stay unclaimed, resolve to Ollama and get no cloud capabilities; untagged cloud ids, namespaced tags and catalog ids are unchanged
  • validation-models.test.ts: the router accepts tagged colliding names on self-hosted where Ollama is reachable, and still rejects them on hosted
  • An independent review compared the old and new resolution across every catalog id (and uppercase forms) plus ~60 adversarial ids: only bare tagged names change
  • tsc --noEmit, bun run lint and the test-pattern/test-type audits clean; vitest across providers, blocks, workflows, executor, permission groups, access control, billing, tokenization, guardrails and tools pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…llama

findProviderFromModel matched provider patterns (/^gpt/, /^mistral/, /^claude/,
...) against any id that no namespace or catalog entry claimed. The browser
registers the installed Ollama list, so the editor resolved a local model such
as gpt-oss:20b or mistral:latest to Ollama, but the server never holds that
list: execution fell through to the cloud pattern and sent the request to
OpenAI or Mistral with the user's key, or failed on a missing one.

Ollama lists every installed model as name:tag, and no cloud model id carries
an Ollama tag, so a bare tagged name is now left unclaimed before patterns
run and getProviderFromModel defaults it to Ollama, the same as every other
local name. Namespaces and exact catalog ids still win first, so
bedrock/...:0 and openrouter/...:free are unaffected. Saved workflows heal
without a migration, and the editor, execution, permission checks and the
editing validator now agree on the provider.

getModelCapabilities re-implemented the pattern scan and kept reporting a
cloud provider's capabilities for these names; it now falls back to
findProviderFromModel so the two cannot disagree.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 23, 2026 8:00pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found.

Summary

Routes otherwise unclaimed tagged Ollama names away from cloud-prefix matching.

  • Tagged local model names now go to Ollama instead of cloud providers.

Author waleedlatif1 explicitly identifies local fallback exclusion and removal of inherited cloud capabilities as intended. Untagged names remain ambiguous and are outside this fix.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Model name] --> B{Explicit provider namespace?}
  B -->|Yes| C[Use named provider]
  B -->|No| D{Exact catalog match?}
  D -->|Yes| E[Use catalog provider]
  D -->|No| F{Tagged Ollama-shaped name?}
  F -->|Yes| G[Leave unclaimed]
  F -->|No| H[Check provider prefixes]
  G --> I[Execution defaults to Ollama]
Loading

Reviews (1) · Last reviewed commit: "improvement(models): share the ollama mo..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 6e73e14 into staging Nov 23, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/ollama-cloud-named-models branch November 23, 2026 20:12

This branch was previously deployed

1 inactive deployment
Preview — b71aaac0 Deployed Nov 23, 2026 by vercel[bot]
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