[Inference] Fix some stack connectors not showing up in Add Model popover#266020
Conversation
The AddModelPopover in the feature settings page was only listing ES inference endpoints (via useQueryInferenceEndpoints), but not stack connectors (OpenAI, Bedrock, Gemini). This meant that when users clicked 'Add a model' in the feature settings, connectors were missing from the list. Changes: - Switch AddModelPopover from useQueryInferenceEndpoints to useConnectors, which returns both stack connectors and inference endpoints - Extract getConnectorIcon from SubFeatureCard into a shared connector_display utility - Add getConnectorTaskType utility to determine connector task types (stack connectors are always chat_completion; inference endpoints use config.taskType) - Update tests to use connector-based mocks including stack connectors
Address review feedback: the previous implementation switched from useQueryInferenceEndpoints to useConnectors exclusively, which dropped non-chat_completion inference endpoints (e.g. 'completion' used by automatic_import, 'text_embedding') because the server-side /internal/inference/connectors endpoint only returns chat_completion inference endpoints. Now the AddModelPopover merges both data sources: - useConnectors() provides stack connectors (OpenAI, Bedrock, Gemini) and chat_completion inference endpoints with rich display info - useQueryInferenceEndpoints() provides ALL ES inference endpoints across all task types The mergeConnectorsAndEndpoints() function deduplicates by ID, using connectors as the primary source (richer display data) and filling in any inference endpoints not already covered. This ensures: - Stack connectors appear (the original bug fix) - Non-chat_completion endpoints remain available (no regression) - No duplicates when an endpoint exists in both sources Also adds dedicated unit tests for the merge logic and corrects the component tests to accurately reflect the two-source data model.
The popover was filtering connectors by `getConnectorTaskType(connector) === feature.taskType`. Stack connectors (.gen-ai/.bedrock/.gemini) always map to chat_completion, so any feature with a different task type would hide them — including a configured .gemini connector. Since /internal/inference/connectors already restricts the response to chat-completion-compatible items (stack connectors + chat_completion endpoints), the client-side task-type filter was redundant for chat_completion features and actively hiding valid connectors elsewhere. Drops the filter entirely along with the now-unused merge with useQueryInferenceEndpoints, the taskType prop on AddModelPopover, and the getConnectorTaskType / mergeConnectorsAndEndpoints helpers. Tests updated; .gemini stack connector now has explicit coverage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ApprovabilityVerdict: Needs human review This bug fix changes which connectors appear in the Add Model popover by switching to a different data source hook. All modified files are owned by @elastic/search-kibana, and the author is not a designated owner, warranting review by the owning team. You can customize Macroscope's approvability policy. Learn more. |
The Add Model popover now reads only from /internal/inference/connectors, but the Scout fixture's mockConnectors returned a single stack connector and mockInferenceEndpoints mocked a route the popover no longer reads. Searching for 'anthropic' in the popover matched zero options. Updates mockInferenceEndpoints to also re-route /internal/inference/connectors with the stack connector plus the chat_completion endpoints transformed into InferenceConnector shape, mirroring what getConnectorList returns server-side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
|
|
Starting backport for target branches: 9.4 https://github.com/elastic/kibana/actions/runs/25100414137 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…el popover (#266020) (#267348) # Backport This will backport the following commits from `main` to `9.4`: - [[Inference] Fix some stack connectors not showing up in Add Model popover (#266020)](#266020) <!--- Backport version: 11.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Sander Philipse","email":"94373878+sphilipse@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-04-29T09:09:40Z","message":"[Inference] Fix some stack connectors not showing up in Add Model popover (#266020)\n\n## Summary\n\nThis fixes some stack connectors not showing up in the Add Model\npopover.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>","sha":"ee190daf52d2aa707c035ec4b65398ceff3afc37","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","Team:Search","backport:version","v9.4.0","v9.5.0"],"title":"[Inference] Fix some stack connectors not showing up in Add Model popover","number":266020,"url":"https://github.com/elastic/kibana/pull/266020","mergeCommit":{"message":"[Inference] Fix some stack connectors not showing up in Add Model popover (#266020)\n\n## Summary\n\nThis fixes some stack connectors not showing up in the Add Model\npopover.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>","sha":"ee190daf52d2aa707c035ec4b65398ceff3afc37"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/266020","number":266020,"mergeCommit":{"message":"[Inference] Fix some stack connectors not showing up in Add Model popover (#266020)\n\n## Summary\n\nThis fixes some stack connectors not showing up in the Add Model\npopover.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>","sha":"ee190daf52d2aa707c035ec4b65398ceff3afc37"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
This fixes some stack connectors not showing up in the Add Model popover.