Skip to content

[Inference API] Update authorized endpoints when their fingerprint or version changed#143567

Merged
dimitris-athanasiou merged 11 commits intoelastic:mainfrom
dimitris-athanasiou:update-authorized-endpoints-on-fingerprint-or-version-change
Mar 6, 2026
Merged

[Inference API] Update authorized endpoints when their fingerprint or version changed#143567
dimitris-athanasiou merged 11 commits intoelastic:mainfrom
dimitris-athanasiou:update-authorized-endpoints-on-fingerprint-or-version-change

Conversation

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor

This PR modifies the AuthorizationPoller so that it selects to persist endpoints that:

  • are new
  • have a different fingerprint
  • have a newer version

Updating endpoints that have a different fingerprint allows dynamic updates when EIS modifies the endpoint metadata.

Updating endpoints that have a different version allows persisting EndpointMetadata fields that could not be parsed before.

In addition, in this PR I have removed the logic for handling out-of-sync endpoints added in #138934 as it is no longer needed. This was necessary for authorized endpoints only. For those, if they are not in cluster state we'll now overwrite the doc in the index and update the cluster state. This ammends the out-of-sync problem if it ever occurs.

… version changed

This PR modifies the `AuthorizationPoller` so that it selects to persist endpoints that:

  - are new
  - have a different fingerprint
  - have a newer version

Updating endpoints that have a different fingerprint allows dynamic updates when EIS modifies the endpoint
metadata.

Updating endpoints that have a different version allows persisting `EndpointMetadata` fields that could not
be parsed before.

In addition, in this PR I have removed the logic for handling out-of-sync endpoints added in elastic#138934 as it
is no longer needed. This was necessary for authorized endpoints only. For those, if they are not in
cluster state we'll now overwrite the doc in the index and update the cluster state. This ammends the
out-of-sync problem if it ever occurs.
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/search-inference-team (Team:Search - Inference)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @dimitris-athanasiou, I've created a changelog YAML for you.

Copy link
Copy Markdown
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Left a few questions and suggestions.

);
}

private void testEndpointGetsUpdated_GivenFingerprintChanged(String originalFingerprint, String updatedFingerprint) throws Exception {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up I've struggled to get these type of tests to succeed reliably. A number of them have been muted: #138012

If you have time, another set of eyes would be good to figure out why they are so flaky. I've tried to fix them a few times 😞

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did notice those issues. I wonder if #143584 might have been some of that. But I couldn't find full logs. Next time we get a failure I'll dive in.


var modelsWithoutDuplicates = models.stream().distinct().toList();

Set<String> duplicateInferenceIds = findDuplicateInferenceIds(modelsWithoutDuplicates);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a situation where we receive multiple models with different definitions but the same inference id we could apply them all right? That certainly would be inefficient but I don't think it'd cause errors right? If we consider this functionality similar to elasticsearch's _bulk api I think we could return successes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handling we do here would need to change if we accepted duplicate models.

But I don't see anything that stops us from changing this. Then again, given this is only an internal action we control, I wonder if keeping the duplicate check would help us pick up some issue.

Not sure. Do you have a preference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have discussed this offline and decided to keep the duplicate id check in. In addition, we'll remove the var modelsWithoutDuplicates = models.stream().distinct().toList(); line as it is no longer necessary.

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor Author

@jonathan-buttner I have addressed review feedback. This is ready for another look.

ResourceNotFoundException e = expectThrows(
ResourceNotFoundException.class,
() -> modelRegistry.getMinimalServiceSettings(
Set.of("model_id_" + randomIntBetween(0, createdModels.size() - 1), "non_matching_id"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we move the string id logic to a helper method since we use it a couple times?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in ef46573

@dimitris-athanasiou dimitris-athanasiou merged commit f5c3e5f into elastic:main Mar 6, 2026
35 checks passed
@dimitris-athanasiou dimitris-athanasiou deleted the update-authorized-endpoints-on-fingerprint-or-version-change branch March 6, 2026 06:49
spinscale pushed a commit to spinscale/elasticsearch that referenced this pull request Mar 6, 2026
… version changed (elastic#143567)

This PR modifies the `AuthorizationPoller` so that it selects to persist endpoints that:

  - are new
  - have a different fingerprint
  - have a newer version

Updating endpoints that have a different fingerprint allows dynamic updates when EIS modifies the endpoint
metadata.

Updating endpoints that have a different version allows persisting `EndpointMetadata` fields that could not
be parsed before.

In addition, in this PR I have removed the logic for handling out-of-sync endpoints added in elastic#138934 as it
is no longer needed. This was necessary for authorized endpoints only. For those, if they are not in
cluster state we'll now overwrite the doc in the index and update the cluster state. This ammends the
out-of-sync problem if it ever occurs.
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Mar 6, 2026
This fixes debug log messages added in elastic#143567 where the endpoint
id is not correctly included.
dimitris-athanasiou added a commit that referenced this pull request Mar 6, 2026
)

This fixes debug log messages added in #143567 where the endpoint
id is not correctly included.
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Mar 6, 2026
… version changed (elastic#143567)

This PR modifies the `AuthorizationPoller` so that it selects to persist endpoints that:

  - are new
  - have a different fingerprint
  - have a newer version

Updating endpoints that have a different fingerprint allows dynamic updates when EIS modifies the endpoint
metadata.

Updating endpoints that have a different version allows persisting `EndpointMetadata` fields that could not
be parsed before.

In addition, in this PR I have removed the logic for handling out-of-sync endpoints added in elastic#138934 as it
is no longer needed. This was necessary for authorized endpoints only. For those, if they are not in
cluster state we'll now overwrite the doc in the index and update the cluster state. This ammends the
out-of-sync problem if it ever occurs.
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Mar 6, 2026
…tic#143743)

This fixes debug log messages added in elastic#143567 where the endpoint
id is not correctly included.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants