fix(sse): bridge generic compatible-provider type id to concrete node id in credential lookup - #10434
Open
diegosouzapw wants to merge 2 commits into
Open
Conversation
… id in credential lookup getProviderSearchPool only bridged a provider string to a node id via the node's prefix, never via the generic derived type id (openai-compatible-chat / openai-compatible-responses / anthropic-compatible) that resolveProviderNodeForConnection already accepts at connection-creation time (#4421). A connection persisted under the generic type id was therefore unreachable when the chat path resolved the concrete uuid node id, surfacing "No active credentials for provider: openai-compatible-chat-<uuid>" even though the key and model catalog were valid. Closes #10085
….json check:mutation-test-coverage --strict flagged tests/unit/10085-compatible-generic-vs-uuid-credential.test.ts as a covering test for src/sse/services/auth.ts that was missing from stryker.conf.json's tap.testFiles, per the CI Fast Quality Gates run on PR #10434.
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.
Closes #10085
Root cause
getProviderSearchPool(src/sse/services/auth.ts) built the credentialsearch pool for a custom OpenAI-compatible / Anthropic-compatible provider
node by bridging the searched provider string to a node id only via the
node's
prefix. It never bridged the generic derived type id(
openai-compatible-chat,openai-compatible-responses,anthropic-compatible) to the node's concrete uuid node id(
openai-compatible-chat-<uuid>), even thoughresolveProviderNodeForConnection(src/lib/db/providers/nodes.ts, #4421)already accepts the bare generic type id at connection-creation time.
Result: a connection persisted under the generic type id (e.g. via
/api/providersposting the bare type) became permanently unreachable fromthe chat path, which resolves the concrete uuid node id — surfacing
No active credentials for provider: openai-compatible-chat-<uuid>eventhough the API key and model catalog were valid. The provider "Test" button
and
/v1/modelscatalog hit the upstream directly and never touchprovider_connections, which is why those "worked" while chat failed.Fix
Expand the custom-provider node-expansion loop in
getProviderSearchPooltoalso add a node's
nodeIdto the search pool when the searched providerequals that node's generic derived type id (via
nodeTypeFromId, the sameUUID-stripping helper
resolveProviderNodeForConnectionuses), andsymmetrically add the generic type id when the searched provider is the
concrete node id — mirroring the creation-time resolver so the two paths
agree.
Regression test
tests/unit/10085-compatible-generic-vs-uuid-credential.test.ts(adaptedfrom the plan-file's RED probe):
Gates run
npm run typecheck:core— cleannpx eslint --suppressions-location config/quality/eslint-suppressions.json src/sse/services/auth.ts tests/unit/10085-compatible-generic-vs-uuid-credential.test.ts— cleannode scripts/check/check-test-discovery.mjs— OK, new test file discovered, no new orphansnode scripts/check/check-complexity.mjs/check-cognitive-complexity.mjscould not complete locally within a reasonable window due to devbox saturation from a large parallel fan-out (manycheck-complexity.mjsprocesses contending simultaneously); the change is a small, flat, early-return addition inside an existing loop, and CI (quality-gatejob) will validate it.npm run test:unitwas not re-run locally for the same saturation reason; the targeted regression file is green and the change touches no other call sites ofgetProviderSearchPool.