fix: match compatible-provider models owned by public prefix - #13831
Merged
diegosouzapw merged 3 commits intoSep 16, 2026
Merged
diegosouzapw merged 3 commits into
diegosouzapw merged 3 commits into
Conversation
Resolves diegosouzapw#13829 The provider-scoped /v1/providers/{provider}/models route filters unified-catalog rows by internal provider ID. For compatible provider nodes, the catalog emits the configured public prefix in owned_by, so all valid models were dropped and the endpoint returned an empty list. Resolve the compatible node's prefix and accept it alongside the internal ID when filtering and when stripping the prefix from returned model ids.
…gosouzapw#13829 Two gate-only touch-ups on top of the fix, no behaviour change: - prettier --check rejected tests/unit/provider-models-v1-route.test.ts over a double blank line before a test block. - typing the map callback removed the file's only `any`, which left the frozen entry in config/quality/eslint-suppressions.json unused; the lint gate fails on a stale suppression, so it is pruned. Both were found by running the gates locally, because this fork PR's workflow runs are still awaiting maintainer approval and only the semgrep check had run. Co-authored-by: sahildaswani <sahildaswani@users.noreply.github.com>
This was referenced Sep 16, 2026
diegosouzapw
merged commit Sep 16, 2026
ff493da
into
diegosouzapw:release/v3.8.51
11 of 16 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…uzapw#13831) * fix: match compatible-provider models owned by public prefix Resolves diegosouzapw#13829 The provider-scoped /v1/providers/{provider}/models route filters unified-catalog rows by internal provider ID. For compatible provider nodes, the catalog emits the configured public prefix in owned_by, so all valid models were dropped and the endpoint returned an empty list. Resolve the compatible node's prefix and accept it alongside the internal ID when filtering and when stripping the prefix from returned model ids. * chore(quality): satisfy the format and lint-suppression gates for diegosouzapw#13829 Two gate-only touch-ups on top of the fix, no behaviour change: - prettier --check rejected tests/unit/provider-models-v1-route.test.ts over a double blank line before a test block. - typing the map callback removed the file's only `any`, which left the frozen entry in config/quality/eslint-suppressions.json unused; the lint gate fails on a stale suppression, so it is pruned. Both were found by running the gates locally, because this fork PR's workflow runs are still awaiting maintainer approval and only the semgrep check had run. Co-authored-by: sahildaswani <sahildaswani@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Co-authored-by: sahildaswani <sahildaswani@users.noreply.github.com>
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
GET /api/v1/providers/{provider}/modelsreturned an emptydataarray for compatible provider nodes even though the connection was active, imported/synced models existed, and the same models were routable and listed in the unified catalog with the node's public prefix.The route resolved compatible IDs enough to pass validation, but then filtered unified-catalog rows only by the internal provider node ID:
For compatible provider nodes, the unified catalog emits the node's configured public prefix in
owned_by(for examplehz) rather than the internal ID (for exampleopenai-compatible-chat-<uuid>), so every valid model was dropped. ThetoUnprefixedModelId()helper had the same identity gap: it strippedproviderAlias/andproviderId/, but not the compatible node's public prefix.This change resolves the compatible node's
prefixand:owned_by;Related Issues
Validation
Change type: provider / routing.
openai-compatible-chat-<uuid>with prefixhz), an active connection, and one imported synced model, then asserts:hz/<model>withowned_by: "hz";/api/v1/providers/{internal-id}/modelsreturns that model with its unprefixed ID,owned_by: "hz", andparent: null.node --import tsx/esm --test tests/unit/provider-models-v1-route.test.tsnpm run check:provider-consistency,npm run check:provider-assetsnpx eslint ... --pass-on-unpruned-suppressionsnpm run check:any-budget:t11passesThe only change to production code is the provider-models route; no migrations or feature flags are involved.
Tests Added Or Updated
tests/unit/provider-models-v1-route.test.ts— added the#13829regression test; the touched lines use{ id: string }instead ofanyin the existingbody.data.mapcallbacks (removing twoanysuppressions that were already unnecessary).Coverage Notes
This PR changes
src/(the route). The new test covers the exact regression scenario end to end: node prefix resolution,owned_bymatching against the public prefix, and unprefixing of returned IDs. The existing suite already covered the unknown-provider 400 and service-backend paths.Reviewer Notes
getProviderNodeById) and fail soft: if the node is missing or has no prefix, behavior is unchanged from before.providerAliasalready equals the public prefix for some existing provider, the accepted-owners set collapses to the same value — no duplication or double-strip, because unprefixing is checked once per prefix.