Repository navigation
fix(models): route tagged ollama names that share a cloud prefix to ollama - #10351
Merged
Merged
Conversation
…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.
…olver and the validator
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issue was found. SummaryRoutes otherwise unclaimed tagged Ollama names away from cloud-prefix matching.
Author waleedlatif1 explicitly identifies local fallback exclusion and removal of inherited cloud capabilities as intended. Untagged names remain ambiguous and are outside this fix.
|
This branch was previously deployed
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.
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, sofindProviderFromModelfell 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 keyOllama 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, andgetProviderFromModelruns it on Ollama like every other local model. It's a synchronous check: no network lookup, and hosted is unaffectedCatalog and namespaced ids still win first:
bedrock/…:0,openrouter/…:free,ollama/<name>and untagged cloud ids resolve as beforegetModelCapabilitiesnow falls back tofindProviderFromModelinstead of its own copy of the pattern scan, so the two can't disagreeThe Ollama name rule is defined once (
OLLAMA_MODEL_NAMEinproviders/models.ts) and shared with the editing validatorBehaviour notes for these names:
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/mistralis the explicit formType of Change
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:7band a namespaced tagged name resolve toollama. These fail on the previous codeproviders/models.test.ts: tagged names stay unclaimed, resolve to Ollama and get no cloud capabilities; untagged cloud ids, namespaced tags and catalog ids are unchangedvalidation-models.test.ts: the router accepts tagged colliding names on self-hosted where Ollama is reachable, and still rejects them on hostedtsc --noEmit,bun run lintand the test-pattern/test-type audits clean; vitest across providers, blocks, workflows, executor, permission groups, access control, billing, tokenization, guardrails and tools passChecklist