Skip to content

[Inference] Align getForFeature with useLoadConnectors logic#264166

Merged
saikatsarkar056 merged 3 commits intoelastic:mainfrom
sphilipse:search-inference-endpoints-default-ai-connector
Apr 21, 2026
Merged

[Inference] Align getForFeature with useLoadConnectors logic#264166
saikatsarkar056 merged 3 commits intoelastic:mainfrom
sphilipse:search-inference-endpoints-default-ai-connector

Conversation

@sphilipse
Copy link
Copy Markdown
Member

@sphilipse sphilipse commented Apr 17, 2026

Summary

This applies the correct behave to the getForFeature function, which was not yet doing this.

  • When defaultOnly is set, only the default connector is returned (or an empty list if the default is missing, unset, or set to the NO_DEFAULT_CONNECTOR sentinel).
  • When the feature has no admin SO override, the default connector is prepended to the resolved endpoints and deduplicated.
  • When an SO override exists for the feature, the default is ignored so admin intent wins.

…getForFeature

Adds `getForFeatureWithDefault`, which wraps `getForFeature` and applies the
global default AI connector configured via advanced settings
(`genAiSettings:defaultAIConnector` and
`genAiSettings:defaultAIConnector:defaultOnly`):

- When `defaultOnly` is set, only the default connector is returned (or an
  empty list if the default is missing, unset, or set to the
  `NO_DEFAULT_CONNECTOR` sentinel).
- When the feature has no admin SO override, the default connector is
  prepended to the resolved endpoints and deduplicated.
- When an SO override exists for the feature, the default is ignored so
  admin intent wins.

The plugin's `endpoints.getForFeature` contract now routes through this new
helper so downstream callers transparently pick up the configured default.

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 17, 2026 16:59
@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 17, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 17, 2026

Approvability

Verdict: Needs human review

This PR introduces new runtime behavior by propagating UI settings for default AI connector to the inference endpoint resolution logic. The new getForFeatureWithDefault function changes how connectors are resolved for features - a significant behavior change that should be reviewed by the @elastic/search-kibana team who own these files.

You can customize Macroscope's approvability policy. Learn more.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

@seialkali
Copy link
Copy Markdown
Contributor

@elasticmachine merge upstream

@saikatsarkar056 saikatsarkar056 merged commit 90e9aae into elastic:main Apr 21, 2026
18 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

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

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 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 added a commit that referenced this pull request Apr 21, 2026
…264166) (#264707)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Inference] Align getForFeature with useLoadConnectors logic
(#264166)](#264166)

<!--- Backport version: 9.6.6 -->

### 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-21T13:24:46Z","message":"[Inference]
Align getForFeature with useLoadConnectors logic (#264166)\n\n##
Summary\n\nThis applies the correct behave to the getForFeature
function, which was\nnot yet doing this.\n\n- When `defaultOnly` is set,
only the default connector is returned (or\nan empty list if the default
is missing, unset, or set to the\n`NO_DEFAULT_CONNECTOR` sentinel).\n-
When the feature has no admin SO override, the default connector
is\nprepended to the resolved endpoints and deduplicated.\n- When an SO
override exists for the feature, the default is ignored so\nadmin intent
wins.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context)
<noreply@anthropic.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"90e9aae3e347b7286dd61c05fe2fc14a3fdfbe28","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Search","backport:version","v9.4.0","v9.5.0"],"title":"[Inference]
Align getForFeature with useLoadConnectors
logic","number":264166,"url":"https://github.com/elastic/kibana/pull/264166","mergeCommit":{"message":"[Inference]
Align getForFeature with useLoadConnectors logic (#264166)\n\n##
Summary\n\nThis applies the correct behave to the getForFeature
function, which was\nnot yet doing this.\n\n- When `defaultOnly` is set,
only the default connector is returned (or\nan empty list if the default
is missing, unset, or set to the\n`NO_DEFAULT_CONNECTOR` sentinel).\n-
When the feature has no admin SO override, the default connector
is\nprepended to the resolved endpoints and deduplicated.\n- When an SO
override exists for the feature, the default is ignored so\nadmin intent
wins.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context)
<noreply@anthropic.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"90e9aae3e347b7286dd61c05fe2fc14a3fdfbe28"}},"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/264166","number":264166,"mergeCommit":{"message":"[Inference]
Align getForFeature with useLoadConnectors logic (#264166)\n\n##
Summary\n\nThis applies the correct behave to the getForFeature
function, which was\nnot yet doing this.\n\n- When `defaultOnly` is set,
only the default connector is returned (or\nan empty list if the default
is missing, unset, or set to the\n`NO_DEFAULT_CONNECTOR` sentinel).\n-
When the feature has no admin SO override, the default connector
is\nprepended to the resolved endpoints and deduplicated.\n- When an SO
override exists for the feature, the default is ignored so\nadmin intent
wins.\n\n---------\n\nCo-authored-by: Claude Opus 4.7 (1M context)
<noreply@anthropic.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"90e9aae3e347b7286dd61c05fe2fc14a3fdfbe28"}}]}]
BACKPORT-->

Co-authored-by: Sander Philipse <94373878+sphilipse@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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.

5 participants