Repository navigation
fix(catalog): resolve gateway model metadata from other publishers - #1036
Merged
vastsa merged 1 commit intoSep 24, 2026
Merged
Conversation
models.dev indexes a gateway's copy of a model under the vendor that owns the weights, not under the gateway. An endpoint serving `Vendor/Model` ids such as `deepseek-ai/DeepSeek-V4-Flash-0731` therefore has no record of its own while several other publishers state the identical id. `findModel` scoped the lookup to the row's own catalog provider once that provider was known, so every such model missed and fell back to the generic 128k text-only shape, leaving its context window and tool support invisible. On ModelScope none of the 31 models its endpoint serves resolved; 14 do now. Borrowing is deliberately narrow. It runs only when the row resolved to a catalog provider that published nothing for the id, and only for a case-insensitive identical id: a record reached through an alias describes a different id and keeps its own limits. A provider sharing the row's endpoint is skipped, because it is an alias for the row and its silence answers for this deployment. Tool support must be unanimous across publishers, since a wrong `true` puts tool declarations on the wire that the endpoint may reject, while reasoning, vision and attachment are intersections and limits are medians, so a borrow can only under-claim. An unknown endpoint keeps its existing behaviour. The issue suggested widening suffix matching for ids such as `-0731`; that is not the defect. Exact matching already accepts those ids, and a global weak match would conflate distinct models (`Qwen/Qwen3.5-27B` and `Qwen/Qwen3-235B-A22B-...-2507` normalize alike). This changes metadata only: configured ids, provider identity and binding precedence are untouched. fixes vastsa#938
vastsa
force-pushed
the
fix/catalog-cross-provider-model-metadata
branch
from
September 24, 2026 18:43
7e43e3e to
b293f53
Compare
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.
Problem
Configuring ModelScope (an OpenAI-compatible gateway at
https://api-inference.modelscope.cn/v1) in PI-Desktop left the context window and tool support unidentified for most of the models its endpoint serves (#938).The issue proposed widening the model-id matching ("weak matching"), since metadata lookup keys off the exact model id and ids carry a vendor prefix and date suffixes such as
0731. That is not the defect. Exact matching already accepts those ids:catalogModelIdsMatchQwen/Qwen3-235B-A22B-Instruct-2507vs itselfdeepseek-ai/DeepSeek-V4-Flash-0731vs itselfA global weak match would make things worse, not better:
Qwen/Qwen3.5-27BandQwen/Qwen3-235B-A22B-...-2507normalize to the sameqwen/qwen3-...family, so a fuzzy lookup would hand the 235B's window to the 27B.Root cause
models.dev indexes a gateway's copy of a model under the vendor that owns the weights, not under the gateway:
modelscopepublishes only 7 records of its own (older Qwen3-2507 / GLM ids)deepseek-ai/DeepSeek-V4-Flash-0731is published verbatim by 11 other providers (deepinfra, nebius, huggingface, nvidia, …)ModelsDevCatalog.findModelscopes the lookup to the row's own catalog provider once that provider is known (models-dev-catalog.ts:1079), so every one of those ids missed and fell back to the generic 128k text-only shape.Measured against the real endpoint and the bundled snapshot: 0 of 31 ModelScope text models resolved before the change; 14 resolve after.
Change
Adds a cross-provider exact-id fallback, consulted only when the row resolved to a known catalog provider that published nothing for the id. Four deliberate constraints:
proxy/openai/gpt-4o) is a different id and keeps its own limits.trueputs tool declarations on the wire that the endpoint may reject.Metadata only: configured wire ids, provider identity, IPC and binding precedence are untouched.
Files
apps/desktop/electron/main/models-dev-catalog.ts—borrowedModel()+ModelsDevCatalog.borrowedAcrossProviders()apps/desktop/test/models-dev-catalog.test.mjs— 7 new tests (2 confirmed failing on the pre-fix code)docs/spec/03-runtime/13-model-catalog-and-selection.md— new §11.3.1Verification
pnpm --filter @pi-desktop/shared testnode --test test/models-dev-catalog.test.mjspnpm --filter @pi-desktop/desktop typecheckpnpm build:jspnpm check:architecture,pnpm check:agent-policy,pnpm check:pr-baseAlso self-checked: aliases are never borrowed, memoization cannot leak a borrow into a provider-scoped row,
reasoning: falseexposes no thinking levels, and a borrow does not mutate shared catalog records.Known limits
Shanghai_AI_Laboratory/Intern-S1,ZhipuAI/GLM-5.2,PaddlePaddle/ERNIE-*, …) — an upstream data gap a client cannot infer.MiniMax/MiniMax-M1-80k). Both classes still allow a manual Advanced override.pnpm lintfails onapps/desktop/src/styles/composer-menus.css(2 pre-existing style-token violations in a file this PR does not touch).fixes #938