ml-commons icon indicating copy to clipboard operation
ml-commons copied to clipboard

[BUG] Deleting a not-found model or agent via the MLClient throws an exception

Open dbwiddis opened this issue 1 year ago • 3 comments

What is the bug?

When using the ML Client to delete a model or agent which does not exist, the ActionListener failure path is followed with an OpenSearchStatusException with status NOT_FOUND.

This does not match the pattern for Connectors and OpenSearch document deletion where the a DeleteResponse is sent indicating success, but includes a DocWriteResponse.Result.NOT_FOUND result.

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Use the MLClient to register a model or agent
  2. Use the REST API to delete that model or agent
  3. Use the MLClient to unregister/delete that model or agent
  4. The ActionListener fails with exception

What is the expected behavior?

ActionListener should send onResponse with a DeleteResponse with NOT_FOUND result.

Suggested FIx

Clearly document "delete" APIs that send DeleteResponse which do not follow the usual pattern.

dbwiddis avatar Jul 25 '24 18:07 dbwiddis