Skip to content

revert(ai): remove MCP Chat, knowledge-pill extraction, and AISettings/Memory Agent - #30041

Merged
pmbrull merged 12 commits into
mainfrom
pmbrull/revert-mcp-ai-pills
Jul 15, 2026
Merged

pmbrull merged 12 commits into
mainfrom
pmbrull/revert-mcp-ai-pills

Conversation

@pmbrull

@pmbrull pmbrull commented Jul 14, 2026

Copy link
Copy Markdown
Member

Reverts an unfinished AI feature cluster that shipped to main but won't be completed, while preserving the entities and teammate features that were later built on top of it. Surgical de-integration, not a blind revert — each reverted PR's follow-on work (persona AI context, semantic-search embeddings, pagination, ui-core migration) is kept intact.

Removed

PR Feature
#26343 (+ test #29169) MCP Chat client, conversation/message tracking, chat UI
#28973 Knowledge-pill extraction from uploaded files
#29119 Knowledge-pill extraction from Context Center pages
#29201 AISettings config plane + Memory/Ontology Agent (glossary/metric derivation)

Kept deliberately (load-bearing for surviving features)

Commits (per-cluster, each compiles + passes the persona canary)

revert(ai): remove AISettings + Memory/Ontology Agent (#29201)
revert(context): remove page knowledge-pill extraction (#29119)
chore(ai): keep metric.json/createMetric.json schema frozen
revert(context-center): remove file knowledge-pill extraction (#28973)
revert(mcp): remove MCP Chat client, conversation tracking, chat UI (#26343, #29169)
revert(ui): reconcile MCP-chat/AI UI removal + checkstyle

Verification

  • Backend compiles + installs; AIContextBuilderTest (persona canary) 16/16 after every cluster; the 3 kept-tool tests + EnumBackwardCompatibilityTest green.
  • openmetadata-integration-tests test-compiles; orphaned ITs removed.
  • UI: organize-imports + eslint (0 errors) + prettier clean on changed files; no dangling deleted-component imports; adds no new tsc errors.
  • mvn spotless:check clean.

Notes

🤖 Generated with Claude Code

pmbrull and others added 6 commits July 14, 2026 12:23
Removes the AISettings config plane and the Memory/Ontology Agent that
derived glossary terms and metrics from ContextMemory. Keeps the
ContextMemory entity (schemas frozen), CreateContextMemoryTool, and the
Persona AI Context feature that reads ContextMemory. Restores the base
McpApplication files #29201 had refactored away.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Reverts the Context Center *page* extraction pipeline (generic
ContextProcessingEngine + File/Page engines, ContextMemoryReconciler,
sourceEntity generalization, ExtractedMemoriesCard UI). Keeps the frozen
ContextMemory/ContextFile/Page schemas, file-side sourceFile handling
(removed later with #28973), and all follow-on work (pinning, pagination,
attachment widget, ui-core-components migration).

This reverts commit 506c8c9.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Extends the D1 schema-freeze decision to the Metric schema: the AI revert
(#29201) removed the Memory/Ontology Agent *code* that populated Metric's
'derivedFrom'/'provider', but the JSON schema fields are left intact (inert)
so re-introducing the feature later needs no schema change. Verified the
service compiles with the fields present and unused.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Removes the file extraction pipeline (ContextFileProcessingService,
ContextMemoryExtractor, the LLM completion-client layer, KnowledgePill,
DocumentStatusBadge UI) and restores the pre-#28973 ContextFileExtractionService
stub. Keeps the 3 MCP context tools (Get/Search/CreateContextMemory), the
object-storage upload + /system/validate stack (D3), and the frozen
ContextMemory/ContextFile schemas (D1).

This reverts commit 03530b2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…26343, #29169)

Removes the MCP Chat feature: chat client service (mcpclient/*), the chat
LLM-client layer (clients/llm/* except LlmConfigHolder), McpConversation/
McpMessage entities+repos+resource+schemas, McpChatApplication, the chat UI
(McpChatPage, /mcp-chat routes) and its playwright spec (#29169), and the
mcp_conversation/mcp_message tables.

KEPT (now load-bearing for semantic-search embeddings, not chat):
llmConfiguration.json + LlmConfigHolder + OpenMetadataApplicationConfig.
llmConfiguration — the vector-embedding stack (SystemRepository, the
*EmbeddingClient family, OpenSearchBulkSink, #29678 AI Context Platform)
depends on it, so a wholesale revert would break semantic search.

Follow-up UI reconciliation (package.json deps, locale keys, ApplicationsProvider,
generated TS) lands in the codegen/i18n commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Finalizes the UI side of the reverts: removes the residual MCP-chat route,
plugin, and provider state; reverse-applies #26343's UI wiring (sidebar,
constants, ApplicationsClassBase); restores getContextMemoryById (still used
by the surviving memories page); fixes the DocumentPreviewPanel status-row
JSX left by the badge removal; and runs the organize-imports + eslint +
prettier sequence. Locale files and orphaned i18n keys are intentionally left
in place (harmless, re-introduction-friendly, in-sync).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@pmbrull
pmbrull requested a review from a team as a code owner July 14, 2026 11:45
Copilot AI review requested due to automatic review settings July 14, 2026 11:45
@greptile-apps

greptile-apps Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Too many files changed for review. (206 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

@github-actions

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.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jul 14, 2026
Comment on lines 193 to +207
ListFilter filter = new ListFilter(include);
if (sourceFileId != null) {
filter.addQueryParam("sourceFileId", sourceFileId.toString());
}
if (sourceEntityId != null) {
filter.addQueryParam("sourceEntityId", sourceEntityId.toString());
}
if (primaryEntityId != null) {
filter.addQueryParam("primaryEntityId", primaryEntityId.toString());
}
ResultList<ContextMemory> memories =
addHref(
uriInfo,
listInternal(uriInfo, securityContext, fieldsParam, filter, limitParam, before, after));
listInternal(
uriInfo,
securityContext,
fieldsParam,
new ListFilter(include),
limitParam,
before,
after));

@gitar-bot gitar-bot Bot Jul 14, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Bug: primaryEntityId filter dropped in ContextMemory list

In ContextMemoryResource.list, the local filter is populated with the primaryEntityId query param (lines 193-196) but then discarded — a fresh new ListFilter(include) is passed to listInternal instead (line 204). Since ListFilter still translates primaryEntityId into a SQL relationship condition (getPrimaryEntityCondition) and the repository has no other filtering hook, the DB-backed list path now silently ignores the primaryEntityId filter and returns all memories. Pass the already-built filter to listInternal.

Pass the built filter (with primaryEntityId) instead of a fresh empty ListFilter.:

ListFilter filter = new ListFilter(include);
if (primaryEntityId != null) {
  filter.addQueryParam("primaryEntityId", primaryEntityId.toString());
}
ResultList<ContextMemory> memories =
    addHref(
        uriInfo,
        listInternal(
            uriInfo,
            securityContext,
            fieldsParam,
            filter,
            limitParam,
            before,
            after));

Was this helpful? React with 👍 / 👎

Comment on lines 110 to 116
@@ -113,7 +113,6 @@ public void initialize(OpenMetadataApplicationConfig config) {
if (config.getObjectStorage() != null) {
maxFileSize = config.getObjectStorage().getMaxFileSize();
}
extractionService.recoverInterruptedProcessing();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Edge Case: Interrupted file text extraction no longer recovered on restart

ContextFileResource.initialize() dropped the extractionService.recoverInterruptedProcessing() call, and the new ContextFileExtractionService has no equivalent. Text extraction is a kept feature, so files left in Analyzing/queued state when the server restarts (e.g. during a rolling deploy) will remain stuck indefinitely with no re-submission. If recovery is intentionally dropped, consider documenting it; otherwise re-add a startup sweep that re-submits files whose head content is not in a terminal ProcessingStatus.

Was this helpful? React with 👍 / 👎

@github-actions

Copy link
Copy Markdown
Contributor

✅ TypeScript Types Auto-Updated

The generated TypeScript types have been automatically updated based on JSON schema changes in this PR.

Copilot AI left a comment

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.85% (75104/115811) 48.64% (44677/91843) 49.4% (13532/27389)

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 1 failure(s), 33 flaky

✅ 4512 passed · ❌ 1 failed · 🟡 33 flaky · ⏭️ 95 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 419 0 1 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 817 0 14 8
🔴 Shard 4 819 1 1 18
🟡 Shard 5 835 0 4 5
🟡 Shard 6 784 0 4 46
🟡 Shard 7 827 0 9 2

Genuine Failures (failed on all attempts)

❌ Features/Glossary/GlossaryTermRelationsGraphNested.spec.ts › viewing a child term: parent appears as a 1-hop neighbour via parentOf edge (shard 4)
�[31mTest timeout of 60000ms exceeded.�[39m
🟡 33 flaky test(s) (passed on retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts › CSV with quoted FQN loads correctly in import grid (shard 3, 2 retries)
  • Features/BulkImportWithDotInName.spec.ts › Full import cycle with dot in service name (shard 3, 1 retry)
  • Features/ContextCenterArchive.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 2 retries)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Text formatting (shard 3, 1 retry)
  • Features/ContextCenterDashboard.spec.ts › Create > Quick Link creates a quick link that appears in the Articles pillar card recent list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › editing memory type persists after save (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › adding a linked asset in edit mode shows entity badge on the row (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › typing the linked table name in the asset search returns it as a result (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › ArrowDown + Enter keyboard navigation selects the linked table result (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with view-only permission cannot see restore or delete actions on an archived document (shard 3, 1 retry)
  • Features/DataProductRenameConsolidation.spec.ts › Rename then change owner - assets should be preserved (shard 3, 1 retry)
  • Features/Glossary/GlossaryMiscOperations.spec.ts › should delete glossary and remove tags from assets (shard 3, 1 retry)
  • Features/Glossary/GlossaryTermRelationsGraphNested.spec.ts › viewing a child term: parentOf edge is rendered between parent and child (shard 4, 2 retries)
  • Pages/CustomProperties.spec.ts › Time Interval (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Date (shard 5, 2 retries)
  • Pages/CustomProperties.spec.ts › Set enum custom property on column and verify in UI (shard 5, 2 retries)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Container (shard 5, 1 retry)
  • Pages/Entity.spec.ts › User as Owner with unsorted list (shard 6, 1 retry)
  • Pages/EntityDataSteward.spec.ts › Tier Add, Update and Remove (shard 6, 1 retry)
  • Pages/ExploreBrowse.spec.ts › service type drill-down disables unrelated roots and query-panel Clear resets it (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to edit glossary terms for dashboardDataModel (shard 7, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to edit glossary terms for searchIndex (shard 7, 1 retry)
  • Pages/GlossaryFormValidation.spec.ts › should show error when glossary name is empty (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary Bulk Import Export (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • ... and 3 more

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

The extraction revert (#28973) over-reverted objectStorage down to a NOOP
stub, but file upload (ContextFile) survives and needs the full
s3/azure/env-overridable config (D3). Restore it to main's version. Net conf
diff is now only the llmConfiguration comment, updated to reference its
surviving consumer (semantic-search embeddings) instead of the removed
extraction/MCP-chat.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 14, 2026 14:48

Copilot AI left a comment

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

karanh37
karanh37 previously approved these changes Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 13:34

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@pmbrull
pmbrull merged commit e6f2bb8 into main Jul 15, 2026
69 of 76 checks passed
@pmbrull
pmbrull deleted the pmbrull/revert-mcp-ai-pills branch July 15, 2026 16:45
@gitar-bot

gitar-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 resolved / 3 findings

Surgical removal of unfinished AI features while preserving load-bearing infrastructure for semantic search and personas. The revert is incomplete as it drops the primaryEntityId filter in ContextMemoryResource and introduces regressions in file extraction recovery and task summary status bucketing.

⚠️ Bug: primaryEntityId filter dropped in ContextMemory list

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/context/ContextMemoryResource.java:193-207

In ContextMemoryResource.list, the local filter is populated with the primaryEntityId query param (lines 193-196) but then discarded — a fresh new ListFilter(include) is passed to listInternal instead (line 204). Since ListFilter still translates primaryEntityId into a SQL relationship condition (getPrimaryEntityCondition) and the repository has no other filtering hook, the DB-backed list path now silently ignores the primaryEntityId filter and returns all memories. Pass the already-built filter to listInternal.

Pass the built filter (with primaryEntityId) instead of a fresh empty ListFilter.
ListFilter filter = new ListFilter(include);
if (primaryEntityId != null) {
  filter.addQueryParam("primaryEntityId", primaryEntityId.toString());
}
ResultList<ContextMemory> memories =
    addHref(
        uriInfo,
        listInternal(
            uriInfo,
            securityContext,
            fieldsParam,
            filter,
            limitParam,
            before,
            after));
💡 Edge Case: Interrupted file text extraction no longer recovered on restart

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/drive/ContextFileResource.java:110-116 📄 openmetadata-service/src/main/java/org/openmetadata/service/drive/ContextFileExtractionService.java:94-102

ContextFileResource.initialize() dropped the extractionService.recoverInterruptedProcessing() call, and the new ContextFileExtractionService has no equivalent. Text extraction is a kept feature, so files left in Analyzing/queued state when the server restarts (e.g. during a rolling deploy) will remain stuck indefinitely with no re-submission. If recovery is intentionally dropped, consider documenting it; otherwise re-add a startup sweep that re-submits files whose head content is not in a terminal ProcessingStatus.

💡 Edge Case: Approved rows with NULL type escape both open/closed buckets

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java:4673-4677 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java:1145-1151

In getTaskCountSummary and buildTaskStatusGroupCondition, an 'Approved' status is bucketed via row-aware predicates: open uses type = 'DataAccessRequest' AND status = 'Approved' and closed uses type <> 'DataAccessRequest' AND status = 'Approved'. In SQL, type <> 'DataAccessRequest' evaluates to NULL (not TRUE) when type is NULL, so an Approved row with a NULL type would be counted in total but in neither openCount nor completedCount, silently breaking the documented openCount + completedCount = total invariant. This is only reachable if task_entity.type can be NULL; if the column is NOT NULL this is a non-issue. Consider making the closed arm explicit (e.g. (type IS NULL OR type <> 'DataAccessRequest') AND status = 'Approved') to be defensive.

🤖 Prompt for agents
Code Review: Surgical removal of unfinished AI features while preserving load-bearing infrastructure for semantic search and personas. The revert is incomplete as it drops the `primaryEntityId` filter in `ContextMemoryResource` and introduces regressions in file extraction recovery and task summary status bucketing.

1. ⚠️ Bug: primaryEntityId filter dropped in ContextMemory list
   Files: openmetadata-service/src/main/java/org/openmetadata/service/resources/context/ContextMemoryResource.java:193-207

   In ContextMemoryResource.list, the local `filter` is populated with the `primaryEntityId` query param (lines 193-196) but then discarded — a fresh `new ListFilter(include)` is passed to `listInternal` instead (line 204). Since ListFilter still translates `primaryEntityId` into a SQL relationship condition (getPrimaryEntityCondition) and the repository has no other filtering hook, the DB-backed list path now silently ignores the `primaryEntityId` filter and returns all memories. Pass the already-built `filter` to `listInternal`.

   Fix (Pass the built filter (with primaryEntityId) instead of a fresh empty ListFilter.):
   ListFilter filter = new ListFilter(include);
   if (primaryEntityId != null) {
     filter.addQueryParam("primaryEntityId", primaryEntityId.toString());
   }
   ResultList<ContextMemory> memories =
       addHref(
           uriInfo,
           listInternal(
               uriInfo,
               securityContext,
               fieldsParam,
               filter,
               limitParam,
               before,
               after));

2. 💡 Edge Case: Interrupted file text extraction no longer recovered on restart
   Files: openmetadata-service/src/main/java/org/openmetadata/service/resources/drive/ContextFileResource.java:110-116, openmetadata-service/src/main/java/org/openmetadata/service/drive/ContextFileExtractionService.java:94-102

   ContextFileResource.initialize() dropped the `extractionService.recoverInterruptedProcessing()` call, and the new ContextFileExtractionService has no equivalent. Text extraction is a kept feature, so files left in Analyzing/queued state when the server restarts (e.g. during a rolling deploy) will remain stuck indefinitely with no re-submission. If recovery is intentionally dropped, consider documenting it; otherwise re-add a startup sweep that re-submits files whose head content is not in a terminal ProcessingStatus.

3. 💡 Edge Case: Approved rows with NULL type escape both open/closed buckets
   Files: openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java:4673-4677, openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java:1145-1151

   In getTaskCountSummary and buildTaskStatusGroupCondition, an 'Approved' status is bucketed via row-aware predicates: open uses `type = 'DataAccessRequest' AND status = 'Approved'` and closed uses `type <> 'DataAccessRequest' AND status = 'Approved'`. In SQL, `type <> 'DataAccessRequest'` evaluates to NULL (not TRUE) when `type` is NULL, so an Approved row with a NULL type would be counted in `total` but in neither `openCount` nor `completedCount`, silently breaking the documented `openCount + completedCount = total` invariant. This is only reachable if task_entity.type can be NULL; if the column is NOT NULL this is a non-issue. Consider making the closed arm explicit (e.g. `(type IS NULL OR type <> 'DataAccessRequest') AND status = 'Approved'`) to be defensive.

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

pmbrull added a commit that referenced this pull request Jul 15, 2026
… extraction feature)

The revert of #28973 (PR #30041) deleted the whole service.llm package, but
#28973 introduced service.llm as a *generic, reusable* LLM completion layer
(its own commit: "LLMCompletionClient layer ... Reusable by other platform
features") — the runtime counterpart to the kept llmConfiguration/LlmConfigHolder.
Downstream (Collate NLQ) reuses it, so deleting it broke the Collate build.

Restore the generic layer (LLMCompletionClient, LLMClientHolder + startup init,
CompletionResult/Options, the provider clients, Noop, factory, exception) and
keep only the extraction feature removed (KnowledgePill and its
ContextMemoryExtractor/ContextFileProcessingService consumers). LLMCompletionClientTest's
pill-parsing cases now use a local PillLike record instead of KnowledgePill.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
pmbrull added a commit that referenced this pull request Jul 15, 2026
… extraction feature) (#30102)

The revert of #28973 (PR #30041) deleted the whole service.llm package, but
#28973 introduced service.llm as a *generic, reusable* LLM completion layer
(its own commit: "LLMCompletionClient layer ... Reusable by other platform
features") — the runtime counterpart to the kept llmConfiguration/LlmConfigHolder.
Downstream (Collate NLQ) reuses it, so deleting it broke the Collate build.

Restore the generic layer (LLMCompletionClient, LLMClientHolder + startup init,
CompletionResult/Options, the provider clients, Noop, factory, exception) and
keep only the extraction feature removed (KnowledgePill and its
ContextMemoryExtractor/ContextFileProcessingService consumers). LLMCompletionClientTest's
pill-parsing cases now use a local PillLike record instead of KnowledgePill.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
pmbrull added a commit that referenced this pull request Sep 4, 2026
The revert in #30041 removed the UI half of knowledge-pill extraction while
this branch restored the backend. The memory -> source link survived (the view
modal renders sourceEntity), but the source -> memories direction did not, so
an article or file had no way to show what was derived from it.

Restores the deleted components as they were and re-wires their call sites:

- ExtractedMemoriesCard: lists a source's pills via
  GET /contextCenter/memories?sourceEntityId=..., opens each in the view modal
- ArticleStatusBadge / DocumentStatusBadge: extraction status, with the
  processing error (or partial chunk coverage) as a tooltip
- KnowledgePageDetailRightPanel: status row + collapsible memories card
- DocumentPreviewPanel: status row, processing-error row, memories card
- DocumentsView: "N memories" in the file row, status badge in the actions
- ContextMemoryListParams regains sourceFileId/sourceEntityId; KnowledgePage
  regains processingStatus/processingError

DocumentPreviewPanel also regains tw:min-h-0: the memories card is shrink-0,
so without it the flex child cannot shrink to the scroll container and the
panel body stops scrolling.

MemoryStatusBadge and DerivedOntologyCard are deliberately not restored. Both
render MemoryProcessingStatus, which tracks the Memory/Ontology Agent
derivation rather than pill extraction, and nothing in the service stamps it
on this branch — they would render nothing. The schema enum stays frozen, so
reviving them needs no schema change.

Tests: ExtractedMemoriesCard and KnowledgePageDetailRightPanel had no coverage
before and now do (fetch params, empty/error states, view modal, owner-based
delete permission, status row gating); DocumentPreviewPanel gains the status,
memories and error-row cases; the playwright spec regains its Status
assertion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
timothybrush pushed a commit to timothybrush/OpenMetadata that referenced this pull request Sep 9, 2026
…nd an AiProvider seam (open-metadata#32524)

* feat(context): restore memory extraction from files and articles behind an AiProvider seam

Re-lands the Context Center knowledge-pill extraction pipeline (engines,
reconciler, repository hooks, list filters, search-index fields) that open-metadata#30041
reverted, without the Memory Agent, AISettings, or MCP Chat. Extraction now
runs behind a pluggable AiProvider seam resolved from
llmConfiguration.aiProviderClass: OSS ships LlmAiProvider (one structured
completion via the shared LLMCompletionClient, all providers supported);
Collate can substitute an agent-platform implementation without any caller
changing. The candidate shape (KnowledgePill) is the compatibility boundary
between the two engines.

Adaptations over the reverted code:
- File pipeline rebuilt on the hardened conditional-update service (open-metadata#31118):
  retry/backoff, contention requeue, RequestEntityCache hygiene now cover the
  pill stage too.
- Extraction gate is llmConfiguration.enabled alone; the AISettings toggles
  are gone.
- AiProviderHolder resolves the configured class via asSubclass and falls
  back to the built-in provider on ClassCastException instead of crashing
  (review finding on open-metadata#29360), pinned by a regression test.
- FileContextProcessingEngine only treats EntityNotFoundException as
  file-gone; infrastructure failures now propagate to a Failed status instead
  of silently marking the file Processed.

Co-Authored-By: Claude Fable 5 <[email protected]>

* Update generated TypeScript types and dereferenced schemas

* refactor(context): drive/ becomes context/center, entity-prompt context becomes context/entity

The service-layer package now matches the domain language: everything Context
Center (file/article extraction engines, the AiProvider seam, KnowledgePill)
lives under context/center, and the AI entity-prompt classes move from the
context/ root into context/entity. 'drive' was the legacy storage name; the
REST surface already says contextCenter. Mechanical move — no behavior change;
all moved-package suites green (48 tests).

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(context): reconciliation keeps pill identity across rephrasing and skips cross-source duplicates

Extraction previously matched derived pills to stored ones by exact normalized
question, so a model that reworded a question between runs retired the old
pill and created a new one — losing its usageCount/lastUsedAt and its
embedding for an unchanged fact. And nothing looked beyond the source being
extracted, so one policy stated in two documents produced two pills.

Reconciliation now runs three passes: exact question match, then word-overlap
similarity for rephrasings (same gate as the server's duplicate probe —
0.6*question + 0.4*answer Jaccard at 0.85), then creation, where a
best-effort search probe checks whether another source's automated pill
already states the fact. A rephrase updates in place; a cross-source
restatement is skipped and counted.

Deliberately deterministic and lexical: the precision gate is word overlap,
so vector recall could not change an outcome, only cost more. Semantic
paraphrase and contradiction detection belong to the scheduled reconciliation
pass, not to extraction time. Manual and chat-authored memories never
suppress extraction — a user's private note must not silence a document's
knowledge — and a probe failure degrades to creating the pill.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(context): review findings — batched memoryCount, throttle eviction, redundant index put

- memoryCount was populated per-entity in setFields but never in either
  repository's setFieldsInBulk, so a list asking for it got 0/null while
  GET-by-id returned the real count. Both ContextFile and Page now fill it
  from one batched MENTIONED_IN query (MemoryCountFetcher), and Page clears
  it when unrequested like ContextFile already did.
- The page extraction throttle evicted a pending page even when the incoming
  id was already tracked, so one actively-autosaved page could repeatedly
  cost unrelated pages their run. Evict only when the page is new.
- Dropped a duplicate sourceType put in ContextMemoryIndex; the field is
  already stamped, null-safely, earlier in the same doc build.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(context): memory extraction gets its own switch, independent of llmConfiguration.enabled

llmConfiguration.enabled turns on embeddings, Ontology Studio AI and every
other completion feature, so a deployment that enabled LLM features for
semantic search was also, silently, asking every upload and article edit to
spend model calls deriving knowledge pills.

Extraction now needs llmConfiguration.memoryExtractionEnabled as well
(LLMClientHolder.isMemoryExtractionEnabled = enabled AND extraction flag).
Off by default in OpenMetadata: extraction here is unmetered, so it is opt-in
and a large upload cannot become unbounded model spend on a self-hosted
deployment without someone asking for it. Ontology Studio AI and the RDF
endpoints keep reading isEnabled — this switch is extraction's alone.

Co-Authored-By: Claude Fable 5 <[email protected]>

* Update generated TypeScript types and dereferenced schemas

* feat(context): restore the extracted-memories panel and status badges

The revert in open-metadata#30041 removed the UI half of knowledge-pill extraction while
this branch restored the backend. The memory -> source link survived (the view
modal renders sourceEntity), but the source -> memories direction did not, so
an article or file had no way to show what was derived from it.

Restores the deleted components as they were and re-wires their call sites:

- ExtractedMemoriesCard: lists a source's pills via
  GET /contextCenter/memories?sourceEntityId=..., opens each in the view modal
- ArticleStatusBadge / DocumentStatusBadge: extraction status, with the
  processing error (or partial chunk coverage) as a tooltip
- KnowledgePageDetailRightPanel: status row + collapsible memories card
- DocumentPreviewPanel: status row, processing-error row, memories card
- DocumentsView: "N memories" in the file row, status badge in the actions
- ContextMemoryListParams regains sourceFileId/sourceEntityId; KnowledgePage
  regains processingStatus/processingError

DocumentPreviewPanel also regains tw:min-h-0: the memories card is shrink-0,
so without it the flex child cannot shrink to the scroll container and the
panel body stops scrolling.

MemoryStatusBadge and DerivedOntologyCard are deliberately not restored. Both
render MemoryProcessingStatus, which tracks the Memory/Ontology Agent
derivation rather than pill extraction, and nothing in the service stamps it
on this branch — they would render nothing. The schema enum stays frozen, so
reviving them needs no schema change.

Tests: ExtractedMemoriesCard and KnowledgePageDetailRightPanel had no coverage
before and now do (fetch params, empty/error states, view modal, owner-based
delete permission, status row gating); DocumentPreviewPanel gains the status,
memories and error-row cases; the playwright spec regains its Status
assertion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(context): stamp Processing when an article extraction run starts

PageProcessingStatus has always declared Processing, but nothing wrote it:
the pipeline went Queued -> Processed/Failed. Because the throttle coalesces
autosaves over a five-minute quiet period, the UI badge sat on Queued for
minutes and then jumped straight to Processed, with no way to tell a run in
flight from one still waiting.

Adds ContextProcessingEngine.markProcessing(UUID) -- a no-op by default,
called from runExtraction after the shouldProcess hash gate rather than at the
top, so an unchanged-content skip stays a single write instead of two.
PageContextProcessingEngine overrides it to stamp Processing.

FileContextProcessingEngine deliberately does not override it:
ContextFileProcessingService already owns the file status flow
(Uploaded -> Analyzing -> ExtractingContext -> Processed/Failed/Unsupported).

Cost is one extra version-free page write plus a reindex per real run, and
none per skip. Known gap, matching the in-memory throttle's existing
behaviour for Queued: a JVM death between the Processing stamp and the
terminal stamp leaves the article on Processing until its next body edit
re-arms the run.

The test helper that captured the single page write now captures all of them
and asserts on the last, since a real run writes twice.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(context): a deleted source leaves no knowledge pills behind

Hard-deleting a Context Center file left its pills in the database forever as
soft-deleted rows. A hard delete runs the soft-delete pass first, which
soft-deleted the pills; the hard pass then looked them up through
deleteExtractedMemories, whose findTo used the default Include.NON_DELETED and
so could not see the rows its own soft pass had just hidden. The result was
invisible tombstones that still held their FQNs and their search and vector
index entries -- exactly what the reconciler's deleteRetired comment argues
against.

deleteExtractedMemories now looks up with Include.ALL and always hard-deletes,
so both delete paths converge on the same outcome: no memories. A pill is
derived data, regenerable from its source, so it should not outlive the source
in any form. This also makes the behaviour consistent for pages, which cannot
soft-delete at all (page.json has no `deleted` property, so
supportsSoftDelete is false) and therefore only ever reached the hard hook.

restoreExtractedMemories and both restoreAdditionalChildren overrides are
removed: with the pills hard-deleted there is nothing left to un-delete. A
restored source is expected to re-derive its pills rather than resurrect
tombstones.

Covered by three ITs in ContextFileIT. They create pills through
POST /contextCenter/memories with sourceEntity set, which writes the same
MENTIONED_IN edge extraction does, so the cascade is exercised without a model
call.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(context): article extraction no longer deletes relatedEntities

Every extraction stamp silently wiped an article's related data assets and
bumped its version. PageContextProcessingEngine.getPage loaded the page with
getFields(""), which leaves the relationship-backed fields null; relatedEntities
is in KNOWLEDGE_UPDATE_FIELDS, so the updater read that null as a removal and
deleted the HAS rows. The article's own version history recorded it as
`fieldsDeleted: relatedEntities` on the first stamp of every run.

Loading getPutFields() instead makes the stamp a real read-modify-write, so
relatedEntities, parent and children round-trip untouched. This also removes the
version churn the surrounding comments say machine extraction avoids: the churn
was never processingStatus (already recorded with updateVersion=false), it was
the relationship deletion riding along with it.

FileContextProcessingEngine keeps getFields(""), which is correct there:
ContextFileRepository declares no patch/put fields, so a file has no
updater-managed relationship to lose. Confirmed against a running instance --
a file's folder survives extraction.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(context): the duplicate probe can actually return a hit

Cross-source dedup never fired. The probe passed the candidate's title,
question and answer joined as one query string, and the search layer applies
AND semantics to a bare query -- so every word had to occur in a single stored
memory. Any one non-matching token returned zero hits, which made
duplicateElsewhere unreachable and the "two documents stating one policy yield
one pill" guarantee false. Measured on a running instance with two identical
uploads: all seven pill pairs score 1.000 against the 0.85 gate, and the run
still logged `0 duplicates skipped`.

  q="Tier B Vendor Requirements"             -> 5 hits
  q="Tier B Vendor Requirements zzzqqqxyz"   -> 0 hits
  q=<the probe's own query>                  -> 0 hits

The query is now an OR of the candidate's distinct words, restoring
should-style recall. Precision is unaffected: the reconciler re-scores every
hit through the same deterministic Jaccard gate.

Recall draws on title and question only. The answer's generic prose dilutes
ranking -- including it, an exact duplicate placed 7th of the 10 hits fetched
and on a larger corpus would fall out of the window; title plus question ranks
that duplicate 2nd, which also matches the gate's own weighting of question
over answer. Tokenizing on non-word characters replaces the old operator
blacklist and is strictly safer: every clause is now a \w+ run, so candidate
text can neither break the query nor smuggle in a lucene operator.

The outage was invisible because the probe logs its failures at debug and
ContextMemoryReconcilerTest supplies a fake probe, so nothing exercised the
real query. New tests pin its shape, which is the whole of the defect.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(context): a rephrased question keeps its pill instead of churning it

Reconciliation matched a derived pill to a stored one using
DUPLICATE_THRESHOLD, the same 0.85 bar used to suppress a duplicate from
another source. That conflates two different questions. Suppressing a
duplicate means "another source already states this" and should demand
near-verbatim agreement; keeping identity means "the model rephrased my fact",
where 0.85 is far too strict -- so a single reworded question orphaned the
pill, and re-extraction deleted and recreated most of a document's pills,
losing their usageCount/lastUsedAt along the way.

Measured on a running instance: editing one number in a seven-pill article
produced 6 created, 1 updated, 1 kept, 5 deleted. Scoring each stored pill
against its best new match gives

  0.85 -> 2 of 7 keep identity
  0.70 -> 4 of 7
  0.50 -> 6 of 7

The seventh scores 0.175 because the model genuinely dropped that fact, so
retiring it is correct and 6 is the ceiling. Splitting out IDENTITY_THRESHOLD
at 0.5 reaches it with a wide margin over the true non-match (0.539 vs 0.175).
DUPLICATE_THRESHOLD stays at 0.85 for cross-source suppression.

The loose bar is safe because removeMostSimilar already claims the best match
above the bar rather than the first, so a weaker candidate cannot take a pill a
closer one should own -- now stated in its contract, since the bar no longer
makes a wrong match implausible on its own. Both measured pairs are covered by
tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ui): extract nested ternary in ExtractedMemoriesCard to fix sonarjs/no-nested-conditional

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rohit0301 <[email protected]>
Co-authored-by: Rohit Jain <[email protected]>

This branch was previously deployed

1 inactive deployment
test — 0c51d00a Deployed Jul 15, 2026 by Rohit0301 via playwright-ci-postgresql (1, 7) #56691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants