Skip to content

[Inference] Fix some stack connectors not showing up in Add Model popover#266020

Merged
sphilipse merged 4 commits into
elastic:mainfrom
sphilipse:harness/inference-fix-not-listing-connectors-in-add-model
Apr 29, 2026
Merged

[Inference] Fix some stack connectors not showing up in Add Model popover#266020
sphilipse merged 4 commits into
elastic:mainfrom
sphilipse:harness/inference-fix-not-listing-connectors-in-add-model

Conversation

@sphilipse
Copy link
Copy Markdown
Member

@sphilipse sphilipse commented Apr 28, 2026

Summary

This fixes some stack connectors not showing up in the Add Model popover.

sphilipse and others added 3 commits April 27, 2026 17:58
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>
@sphilipse sphilipse requested a review from a team as a code owner April 28, 2026 11:17
@sphilipse sphilipse added release_note:skip Skip the PR/issue when compiling release notes Team:Search backport:version Backport to applied version labels v9.4.0 v9.5.0 labels Apr 28, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 28, 2026

Approvability

Verdict: 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>
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] affected Scout: [ observability / apm ] plugin / local-serverless-observability_complete - Custom links template validation - Create custom link with template URL and filters

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
searchInferenceEndpoints 236 237 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
searchInferenceEndpoints 215.8KB 215.3KB -508.0B

History

@sphilipse sphilipse merged commit ee190da into elastic:main Apr 29, 2026
23 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

https://github.com/elastic/kibana/actions/runs/25100414137

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.4 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.4:
- Move all i18n inline (#262363)
- [Inference UI] Add scout tests for feature settings page (#261790)

Manual backport

To create the backport manually run:

node scripts/backport --pr 266020

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label May 1, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 266020 locally
cc: @sphilipse

@sphilipse
Copy link
Copy Markdown
Member Author

💚 All backports created successfully

Status Branch Result
9.4

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Copy Markdown
Contributor

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.
cc: @sphilipse

sphilipse added a commit that referenced this pull request May 4, 2026
…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>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Search v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants