Skip to content

[Agentic search template] Return the not-found error body on metadata-only update of a missing template - #5120

Open
Ifetilayo wants to merge 2 commits into
opensearch-project:mainfrom
Ifetilayo:fix/5035-pr1-update-404
Open

Ifetilayo wants to merge 2 commits into
opensearch-project:mainfrom
Ifetilayo:fix/5035-pr1-update-404

Conversation

@Ifetilayo

@Ifetilayo Ifetilayo commented Oct 8, 2026 •

Copy link
Copy Markdown

Description

Fixes 3.7 from #5035. A metadata-only PUT /_plugins/_ml/agentic_search_templates/{id} for a missing id returned the raw document_missing_exception (index name, shard and uuid included) instead of Agentic search template not found: <id>. The status was already 404; only the body was wrong.

Cause: transport failures arrive wrapped in RemoteTransportException, so the instanceof DocumentMissingException check in writeTemplatePatch never matched. Every instanceof check in AgenticSearchTemplateService (update, get, list, delete, mapping fetch, register conflict) now unwraps the cause first with ExceptionsHelper.unwrapCause. Other exceptions are forwarded unchanged.

Tests: the existing test passed a raw DocumentMissingException and so hid the bug. New cases pass the wrapped form for update, get, delete and register conflict, and one checks that unrelated exceptions pass through as-is.

One of four PRs for #5035. Merge order: #5120 (3.7) → #5121 (3.2–3.5) → #5122 (3.1) → #5123 (3.6).

Related Issues

Part of #5035. Introduced in 3.9 by #4945; the touched files are identical on main and 3.9, so please add backport 3.9.

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 8, 2026 06:33 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 8, 2026 06:33 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 8, 2026 06:33 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 8, 2026 06:33 — with GitHub Actions Waiting
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit a50a3e6)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@Ifetilayo
Ifetilayo marked this pull request as ready for review October 9, 2026 20:52
@Ifetilayo Ifetilayo changed the title [Agentic search template] Return 404 for missing template on metadata-only update [Agentic search template] Return the not-found error body on metadata-only update of a missing template Oct 12, 2026
…agentic search template

Transport failures from client.update/get/delete arrive wrapped in
RemoteTransportException, so the instanceof checks in
AgenticSearchTemplateService never matched and a metadata-only update of
a missing id leaked the raw document_missing_exception. Unwrap the cause
before checking.

Part of opensearch-project#5035 (3.7).

Signed-off-by: Ifetilayo Adebambo <adebambb@amazon.com>
@Ifetilayo
Ifetilayo force-pushed the fix/5035-pr1-update-404 branch from 3f8d5fa to 27f2e71 Compare October 12, 2026 22:04
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 27f2e71

@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 22:06 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 22:06 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 22:06 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 22:06 — with GitHub Actions Waiting
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit a50a3e6

@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 23:59 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 23:59 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 23:59 — with GitHub Actions Waiting
@Ifetilayo
Ifetilayo requested a deployment to ml-commons-cicd-env-require-approval October 12, 2026 23:59 — with GitHub Actions Waiting
@b4sjoo

b4sjoo commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

LGTM

This branch is waiting to be deployed

1 waiting deployment
ml-commons-cicd-env-require-approval — a50a3e67 Waiting Oct 12, 2026 by Ifetilayo via Build and Test MLCommons Plugin on linux (25) #14625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants