Skip to content

fix(search): don't fail the reindex when the embedding provider is unreachable - #31132

Merged
mohityadav766 merged 1 commit into
2.0from
fix/reindex-embedding-optional-2.0
Aug 6, 2026
Merged

fix(search): don't fail the reindex when the embedding provider is unreachable#31132
mohityadav766 merged 1 commit into
2.0from
fix/reindex-embedding-optional-2.0

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

Follows up #30364, which is on main and the 2.0 release branch.

What happens today

#30364 un-gated the staged chunk recreate, so every job-driven full recreate now calls beginStagedChunkRecreate(), which opens with a pre-flight embed. That pre-flight rethrows, and the exception fails the entire SearchIndexApp run — so a reindex that needs no embeddings at all is blocked by an optional AI provider being unreachable.

Why this is not a narrow case

Collate ships naturalLanguageSearch.semanticSearchEnabled=true by default, while llmConfiguration.embeddings.provider defaults to bedrock. And BedrockEmbeddingClient's constructor never calls AWS — it validates model id, dimension and region, then builds the SDK client.

So on any deployment where a region resolves (anything running on AWS) but bedrock:InvokeModel was never granted:

  1. the client constructs happily,
  2. initializeVectorSearchService reports success,
  3. and the first full reindex dies:
User: arn:aws:sts::...:assumed-role/... is not authorized to perform:
bedrock:InvokeModel on resource: .../amazon.titan-embed-text-v2:0
(Service: BedrockRuntime, Status Code: 403)

surfacing as status='failed' within seconds with an empty failureContext.

The misconfiguration is otherwise invisible. Live indexing logs embedding errors and carries on, so the deployment looks healthy right up until someone reindexes. OSS is unaffected — semanticSearchEnabled defaults to false there, so the vector service never initialises and the gate returns early.

This is what has been failing the nightly Java IT reindex suites on main and 2.0 since 2026-08-04.

The change

Treat an unavailable provider as "do not stage" rather than "fail": return null, which the caller already handles as the partial-recreate outcome — existing chunks stay live and get swept by the next recreate that runs with a working provider. markEntityTypeReindexed already ignores marks from a run without staging (the "unbound chunk-type mark" branch), so this reuses a supported state rather than inventing one.

The pre-flight's intent is preserved: it still refuses to stage a generation it could never finish. It just no longer takes the entity reindex down with it.

Genuine staging failures still throw — an indeterminate live-target probe, a failed index create — because those mean continuing could destroy live chunks. The existing beginStagedChunkRecreate_abortsWhenTheLiveTargetProbeIsIndeterminate test still passes unchanged.

Test plan

  • OpenSearchVectorServiceChunkStagingTest — 8/8 pass, including a new case asserting an unavailable provider returns null and touches nothing in the cluster (verify(client, never()).indices() / .generic()).
  • RecreateWithEmbeddingsTest — 7/7 pass.
  • Nightly Java IT once merged.

Unit tests were executed on main; the 2.0 change is character-identical (verified by diffing the two patches) but its module could not be built locally offline.

Related

🤖 Generated with Claude Code

…reachable

#30364 un-gated the staged chunk recreate, so every job-driven full recreate now
calls beginStagedChunkRecreate(), which opens with a pre-flight embed. The
pre-flight rethrows, and that exception fails the whole SearchIndexApp run — so
a reindex that needs no embeddings at all is now blocked by an optional AI
provider being unreachable.

That is not a narrow case. Collate ships semanticSearchEnabled=true by default
while llmConfiguration.embeddings.provider defaults to bedrock, and
BedrockEmbeddingClient's constructor never calls AWS — it validates the model id,
dimension and region, then builds the SDK client. So on any deployment where a
region resolves (anything on AWS) but bedrock:InvokeModel was never granted, the
client constructs happily, initializeVectorSearchService reports success, and the
first full reindex dies:

  User: arn:aws:sts::...:assumed-role/... is not authorized to perform:
  bedrock:InvokeModel on resource: .../amazon.titan-embed-text-v2:0
  (Status Code: 403)

surfacing as status='failed' within seconds with an empty failureContext. The
misconfiguration is otherwise invisible: live indexing logs embedding errors and
carries on, so the deployment looks healthy right up until someone reindexes.
This is what has been failing the nightly Java IT suites on main and 2.0.

Treat an unavailable provider as "do not stage" rather than "fail": return null,
which the caller already handles as the partial-recreate outcome — existing
chunks stay live and are swept by the next recreate that runs with a working
provider. markEntityTypeReindexed already ignores marks from a run without
staging, so this reuses a supported state rather than inventing one.

Genuine staging failures — an indeterminate live-target probe, a failed index
create — still throw, because those mean continuing could destroy live chunks.
@gitar-bot

gitar-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Makes embedding provider failures during search reindexing optional by returning null instead of throwing, allowing reindex jobs to complete when AI services are unreachable. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

@mohityadav766
mohityadav766 merged commit 805891a into 2.0 Aug 6, 2026
3 of 22 checks passed
@mohityadav766
mohityadav766 deleted the fix/reindex-embedding-optional-2.0 branch August 6, 2026 16:38
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

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