ml-commons
ml-commons copied to clipboard
[BUG] Deleting a not-found model or agent via the MLClient throws an exception
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:
- Use the MLClient to register a model or agent
- Use the REST API to delete that model or agent
- Use the MLClient to unregister/delete that model or agent
- 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.