Repository navigation
feat(ai): AISettings + Memory Agent deriving glossary terms and metrics - #29201
Conversation
…ats, AISettings schema - Append DERIVED_FROM as last entry in entityRelationship.json enum (ordinal-safe) - Add provider (ProviderType) field to metric.json and createMetric.json - Add ontologyStats definition and property to contextMemory.json (OntologyStats javaType) - Create configuration/aiSettings.json (AISettings, MemoryExtractionSettings, OntologyAgentSettings, PromptConfig, AIPrompts, AIDeletionPolicy) - Register aiSettings in settings.json enum and config_value oneOf - Add default seed openmetadata-service/src/main/resources/json/data/settings/aiSettings.json Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…EST branch Implements Task 2: AISettingsHandler (validate + merge), SettingsCache seed/merge block for aiSettings.json mirroring searchSettings, and SystemResource PUT branch + reset extension for AI_SETTINGS. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…n reset - loadDefaultAiSettings now declares throws IOException instead of swallowing it with an empty AISettings fallback; call sites in createOrUpdateSetting and resetSettingToDefault wrap with try/catch and re-throw as SystemSettingsException (matching the searchSettings error-handling pattern) - resetSettingToDefault refactored to if/else-if/else with a single trailing return, eliminating the two early returns - AISettingsHandlerTest: add incomingNullReturnsDefaults and nullNestedDefaultInheritsIncoming tests covering null-guard branches Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… extraction prompt - Add AISettingsUtil: cache-backed AISettings accessor (never null, fails open) with isFileExtractionEnabled, isPageExtractionEnabled, isOntologyAgentEnabled, memoryExtractionPrompt, ontologyAgentPrompt helpers - ContextMemoryExtractor.callLlm resolves the system prompt from AISettings at runtime, falling back to the SYSTEM_PROMPT constant - ContextFileProcessingService.process and fileStatusAfterText gate on AISettingsUtil.isFileExtractionEnabled in addition to LLMClientHolder.isEnabled - KnowledgePageRepository.schedulePillExtraction gates on AISettingsUtil.isPageExtractionEnabled in addition to LLMClientHolder.isEnabled - TDD: AISettingsUtilTest written first (RED), then implementation (GREEN) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add OntologyDerivation, OntologyVerdict (Jackson record DTOs with @JsonProperty on every component and @JsonIgnoreProperties), and OntologyAction constants (REUSE/CREATE/SKIP) as the anti-corruption boundary between untrusted LLM JSON and the domain model. Mirrors the KnowledgePill pattern. Covered by OntologyDerivationTest (lenient parse, unknown-field tolerance). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add OntologyContext/OntologyCandidate records, OntologyExtractor (calls LLM via completeStructured, returns SKIP/SKIP on empty result), OntologyPromptBuilder (renders memory + candidate lists), and OntologyGrounding (keyword-searches glossary-term/metric/glossary indexes via Entity.getSearchRepository, caps at 20, fails-safe per axis). Covered by OntologyExtractorTest (mocked LLM, two cases: verdict passthrough + empty-→SKIP/SKIP). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… prompt builder Replace raw "_score"/"desc" with SearchConstants.DEFAULT_SORT_FIELD/DEFAULT_SORT_ORDER, remove local FIELD_NAME/FIELD_DESCRIPTION in favour of Entity constants, dedupe nullToEmpty via StringUtils.defaultString, extract renderMemory() so build() fits 15 lines, use CommonUtil.nullOrEmpty for the candidates guard, and replace raw "CREATE"/"SKIP" string literals in tests with OntologyAction constants. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…retire/cascade) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…e-derive, no-op on all-SKIP Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds OntologyProcessingEngine: a trailing-throttle debounce (mirroring PageContextProcessingEngine) that collapses rapid memory edits into one derivation run, protected by a SHA-256 content hash-gate so unchanged memories are never re-derived. stampOntologyStats persists via recordChange(updateVersion=false) in ContextMemoryUpdater, exactly mirroring KnowledgePageRepository.recordExtractionStats, so no version churn occurs and no postUpdate event fires for the stats field. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…nts, dedup scheduler Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…cascade postCreate/postUpdate schedule the OntologyProcessingEngine (gated on AISettingsUtil.isOntologyAgentEnabled). softDelete/hardDelete/restore AdditionalChildren fire in-edge-window so DERIVED_FROM edges exist when OntologyReconciler.onMemoryDeleted/onMemoryRestored run. Extracted AISettingsUtil.deletionPolicy() to remove duplication between the engine and the repository. Added OntologyReconciler.onMemoryRestored which restores CASCADE-soft-deleted automation-owned entities (Include.ALL query; ORPHAN/DEPRECATE-released entities correctly excluded because their DERIVED_FROM edges were dropped at delete time). Three new unit tests cover: owned restore, human-adopted skip, orphan-released skip. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds the ontology-bot principal seed files (bot + botUser JSON, auto-loaded by BotResource.initialize at startup), the OntologyOwnership utility class (centralized ONTOLOGY_BOT_NAME constant + releaseIfHumanEdited guard), and wires the guard into the entitySpecificUpdate of GlossaryTermUpdater, MetricUpdater and GlossaryUpdater so a human PATCH that changes an agent-managed field flips provider AUTOMATION → USER permanently. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds the AISettingsPage under Settings > Preferences with master enable toggle, memory-extraction and ontology-agent toggles, a deletion-policy Select, and two system-prompt Textareas. Registers the route, menu item, and all i18n keys (synced to all 17 locales). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace raw string literals ('cascade'/'orphan'/'deprecate') in
DELETION_POLICY_OPTIONS with i18n labelKey fields; add new keys
label.cascade / label.deprecate / label.orphan to en-us.json (alphabetical)
and sync all 17 other locales via yarn i18n.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add three read-only derived fields (non-default, resolved at read, never persisted) to expose File→Memory→Term/Metric provenance: - ContextMemory.derivedEntities (entityReferenceList): terms+metrics created by the Ontology Agent via DERIVED_FROM edges (findFrom(memory, CONTEXT_MEMORY, DERIVED_FROM, GLOSSARY_TERM/METRIC)) - ContextMemory.reusedEntities (entityReferenceList): terms+metrics reused via RELATED_TO edges (findTo(memory, CONTEXT_MEMORY, RELATED_TO, GLOSSARY_TERM/METRIC)) - GlossaryTerm.derivedFrom (entityReference): memory that created the term (findTo(term, GLOSSARY_TERM, DERIVED_FROM, CONTEXT_MEMORY)) - Metric.derivedFrom (entityReference): memory that created the metric (findTo(metric, METRIC, DERIVED_FROM, CONTEXT_MEMORY)) Edge directions verified against OntologyReconciler Task-6 code: addDerivedFromEdge stores from=entity→to=memory; reuse() stores from=memory→to=entity for RELATED_TO. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
AISettingsResourceIT: deterministic GET/PUT/reset tests for /system/settings/aiSettings covering default values (enabled=true, deletionPolicy=cascade), PUT persistence, and reset. OntologyAgentIT: deterministic lifecycle tests seeding DERIVED_FROM edges via in-process repository to replicate the reconciler's CREATE path, then driving cascade delete, adopt-on-touch (provider flip), and derivedFrom/derivedEntities projection fields through the public REST API without any LLM dependency. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Add derivedEntities/reusedEntities to ContextMemory generated type - Add derivedFrom to GlossaryTerm and Metric generated types - Add DERIVED_FROM/DERIVED_ENTITIES/REUSED_ENTITIES to TabSpecificField enum - Add getContextMemoryById to contextMemoryAPI - Create DerivedOntologyCard component (+ interface + test): fetches derivedEntities/reusedEntities from a memory and renders linked lists - Embed DerivedOntologyCard into CreateMemoryModal view-only mode so every memory's derived/reused ontology is visible when viewing a memory - Add derivedFrom field to GLOSSARY_TERM_DEFAULT_FIELDS and METRIC_DEFAULT_FIELDS - Add "Derived from memory" link in GlossaryTermsV1 and MetricDetails when derivedFrom is present on the entity - Add i18n keys: label.derived-from-memory, label.derived-ontology, label.reused, message.no-derived-ontology (synced to 19 locales) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ttings returns defaults
CollectionDAO$SettingsRowMapper.getSettings lacked an AI_SETTINGS case in its
switch, causing every getConfigWithKey("aiSettings") call to throw
IllegalArgumentException (swallowed, returning null) → HTTP 204 on every GET.
Added the missing case so aiSettings rows deserialise to AISettings.
Also fixed resetSettingToDefault for AI_SETTINGS: it was returning defaults
without persisting them to the DB (unlike the equivalent searchSettings reset
path which calls systemRepository.createOrUpdate). Now it persists first.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…edAt so cascade, adopt-on-touch, and projection ITs all pass The test helper createAutomationTerm used create-via-REST + termRepo.update to set provider=AUTOMATION, but the EntityRepository update framework only writes to DB when entityChanged=true; provider is not tracked by recordChange so the write was silently no-op'd. Term stayed provider=null in the DB, causing: - Scenario A timeout: isAutomationOwned read null, cascade skipped the term - Scenario B: assertEquals(USER, null) failed at assertion after human PATCH - Scenario C: cascade skipped term, glossary.delete failed with "glossary is not empty" Fix: replace the two-step seed with termRepo.createInternal() directly, mirroring OntologyReconciler.createTerm exactly. Also fixed the reconciler itself: createTerm, createMetric, and resolveOrMintGlossary all called createInternal without setting id or updatedAt; PostgreSQL GENERATED columns extract both from the stored JSON with NOT NULL constraints, so omitting them would cause constraint failures in production. Result: OntologyAgentIT 3/3 GREEN; OntologyReconcilerTest 20/20 + OntologyOwnershipTest 7/7 no regression. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@transaction Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ontext spec Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
…TL (#29268) The SSO Session Renewal suite swaps the server to a short SAML JWT TTL before logging in. At 10s, on a loaded CI runner the initial app bootstrap (loggedInUser, config, permissions) outran that window, so the first /permissions fetch 401'd mid-load; the silent refresh succeeded but the bootstrap request was not retried, leaving the app wedged on the global loading spinner. dropdown-profile never rendered and the renewal tests timed out, exhausting all retries on the 2026-06-22 nightly (run 27929661599). - Raise SHORT_ACCESS_TTL_SECONDS 10 -> 30 so the token outlives bootstrap. 30s stays under EXPIRY_THRESHOLD_MILLES (60s), so the proactive-renewal timer still fires immediately and the refresh-on-expiry behavior under test is unchanged. - Wait for dropdown-profile at the end of loginViaSaml so login is only "done" once the app shell has rendered, making any future bootstrap hang fail in beforeAll with a clear cause instead of mid-test. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
…ntegration tests (#29278)
- AISettings.spec: MCP Server section now exposes only Enable + Origin Header URI (path/originValidation removed), so assert/fill the origin header instead of the removed mcp-server-path field. - McpChat.spec: enable MCP Chat via aiSettings.mcpChat.enabled (PUT /system/settings) and reset it afterwards, instead of installing the retired McpChatApplication app (which now 404s). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
|
Code Review 👍 Approved with suggestions 12 resolved / 13 findingsIntroduces an AISettings configuration plane and Ontology Agent to automate glossary and metric derivation from context memories. Addressing the remaining concerns about glossary minting race conditions and orphaned glossaries upon memory deletion is recommended. 💡 Bug: McpChatServiceHolder.initialize closes service used by in-flight chats📄 openmetadata-service/src/main/java/org/openmetadata/service/mcpclient/McpChatServiceHolder.java:31-45 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/mcpclient/McpClientResource.java:316-324 McpChatServiceHolder.initialize() (called on every AI-settings PUT/reset via reinitMcpChatServiceIfNeeded) calls closeQuietly(instance) on the previous McpClientService and swaps in a new one. A concurrent request that already obtained the old reference via getService()->McpChatServiceHolder.get() may continue to use a now-closed service (e.g., a streaming chat in McpClientResource.chatStream), potentially causing runtime errors mid-conversation when an admin saves settings. Since instance/enabled are read separately, getService() can also briefly observe enabled=true while the new instance is being built. The null-check downstream mitigates the latter, but in-flight requests against the closed instance are not guarded. This is a low-probability concurrency edge during settings changes; consider deferring close until outstanding requests drain or making the service resilient to close-during-use. ✅ 12 resolved✅ Bug: Possible NPE when LLM returns null verdict list
✅ Bug: deriveGlossaryTerms/deriveMetrics toggles have no effect
✅ Edge Case: Glossary minted with unvalidated LLM-supplied name
✅ Quality: derivedFrom link ignores memory id, points to generic list
✅ Quality: Hardcoded Tailwind colors instead of design tokens
...and 7 more resolved from earlier reviews 🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
The CollectionDAO decomposition moved SettingsRowMapper into SystemTokenDAOs.java. Upstream #29201 later added `case AI_SETTINGS -> readValue(json, AISettings.class)` to the original switch in CollectionDAO.java; the --ours merge resolution for that file silently dropped the addition and it was never ported to the relocated mapper. The switch therefore fell through to `default -> throw IllegalArgumentException("Invalid Settings Type aiSettings")` at runtime — a runtime-only drop the green cross-module compile could not catch. SettingsCache.initialize() reads AI_SETTINGS outside its try block (whose catch is IOException-only), so once an aiSettings row exists the throw aborts the whole initializer, leaving later settings unseeded. This broke AISettingsResourceIT, McpChatResourceIT (503 "MCP Chat is not enabled" + Jackson "No content to map"), and CompanyContextPipelineIT (memory agent silently disabled). Restore the AI_SETTINGS case and its import. Verified by an exhaustive content sweep of the split (all switch case-labels, all 2021 SQL fragments, all method names) that AI_SETTINGS was the only unintended drop. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…s/Memory Agent (#30041) * revert(ai): remove AISettings + Memory/Ontology Agent (#29201) 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]> * revert(context): remove page knowledge-pill extraction (#29119) 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]> * chore(ai): keep metric.json/createMetric.json schema frozen 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]> * revert(context-center): remove file knowledge-pill extraction (#28973) 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]> * revert(mcp): remove MCP Chat client, conversation tracking, chat UI (#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]> * revert(ui): reconcile MCP-chat/AI UI removal + checkstyle 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]> * Update generated TypeScript types * fix(revert): keep full objectStorage config for file upload 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]> * minor fix * lint fix * fixed playwright test --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Rohit0301 <[email protected]>



Describe your changes:
Fixes #29285
I added an AISettings configuration plane and an Ontology Agent so that knowledge "memories" (
ContextMemory) automatically become curated Glossary Terms and Metrics, with the fullFile → Memory → Term/Metricprovenance preserved and a clean ownership lifecycle. I did this so the knowledge captured from Context Center files/pages stops being a dead-end and instead feeds the governed ontology, while giving admins one place to toggle every AI feature and tune every internal LLM system prompt.Type of change:
High-level design:
Two layers, schema-first (JSON Schema → generated Java/TS):
AISettings (config plane): a
SearchSettings-style settings entity (configuration/aiSettings.json→SettingsType.AI_SETTINGS→SettingsCacheseed/merge viaAISettingsHandler→SystemResourceGET/PUT/reset → admin UI page under Preferences → AI). It carries a masterenabledkill-switch,memoryExtraction.{fromFiles,fromPages}toggles,ontologyAgent.{enabled,deriveGlossaryTerms,deriveMetrics,deletionPolicy}, and editable system prompts. The previously hardcoded extraction prompt now lives in settings (the code constant remains the cache-miss fallback). File/page extraction now additionally gate on AISettings.Ontology Agent: on
ContextMemorycreate/update,OntologyProcessingEngine(throttled, hash-gated) grounds the memory against the existing instance ontology (top-K keyword search over the glossary-term/metric indexes), thenOntologyExtractorasks the LLM for a per-axis verdict andOntologyReconcilerapplies it: REUSE an existing entity (RELATED_TOedge, not owned), CREATE a new one (provider=automation, newDERIVED_FROMrelationship, minting a glossary if none fits), or SKIP. Writes as a dedicatedontology-bot.Ownership lifecycle:
provider=automation= agent-owned. Adopt-on-touch flips it touseron a human PATCH of a managed field (the agent then never re-manages it). On memory delete, owned entities followdeletionPolicy(cascade/orphan/deprecate) via pre-cleanup*AdditionalChildrenhooks; reused links are just dropped. Recursion is prevented by a content hash-gate (the stat stamp isupdateVersion=false; the hash-gate is load-bearing).Alternatives / compatibility: reuses
ContextMemoryrather than a new entity (consistent with the existing knowledge-pill feature); no DDL migration (generic JSON-column tables + the genericentity_relationshiptable;DERIVED_FROMappended last to preserve enum ordinals); no fixed default glossary (the agent picks the best existing one or mints one).Tests:
Use cases covered
RELATED_TO), nothing created.provider=automation, linkedDERIVED_FROM.Unit tests
AISettingsHandlerTest(3),AISettingsUtilTest(4),OntologyDerivationTest(1),OntologyExtractorTest(2),OntologyReconcilerTest(20),OntologyProcessingEngineTest(2),OntologyOwnershipTest(7). UI:AISettingsPage.test.tsx,DerivedOntologyCard.test.tsx.Backend integration tests
openmetadata-integration-tests/:AISettingsResourceIT(GET/PUT/reset, 3/3) andOntologyAgentIT(cascade, adopt-on-touch, provenance projections, 3/3) — both green against a real DB. These caught two critical product bugs the mocked unit tests could not: a missingSettingsTypecase inCollectionDAO.SettingsRowMapper(empty AISettings GET) and missingid/updatedAton agent-created entities (NOT-NULL failure on PostgreSQL); both fixed.Ingestion integration tests
Playwright (UI) tests
AISettingsPage,DerivedOntologyCard); Playwright E2E to follow if required.Manual testing performed
The integration tests exercise the end-to-end flows (settings round-trip, derivation, cascade, adopt-on-touch) against a real DB via Testcontainers.
UI screen recording / screenshots:
UI changes present (AISettings admin page + "Derived ontology"/"Derived from" provenance panels). Screen recording to be attached by the author (could not capture in this environment).
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.entity_relationship;DERIVED_FROMappended last to preserve ordinals).Greptile Summary
This PR introduces an AISettings configuration plane and an Ontology Agent that automatically derives Glossary Terms and Metrics from
ContextMemoryentries, preserving fullMemory → Term/Metricprovenance viaDERIVED_FROMedges and a clean ownership lifecycle (provider=automation, adopt-on-touch, configurable deletion policy).AI_SETTINGStype) seeded and merged at startup viaSettingsCache, exposed throughSystemResourceGET/PUT/reset endpoints, and consumed byAISettingsUtilto gate all extraction and derivation paths.OntologyProcessingEngine(debounced, hash-gated, single-threaded scheduler) →OntologyGrounding(top-K search over existing terms/metrics/glossaries) →OntologyExtractor(LLM verdict) →OntologyReconciler(REUSE/CREATE/SKIP with FQN prechecks for terms and metrics, glossary minting, retirement by deletion policy).GlossaryTermRepositoryandMetricRepositorygainOntologyOwnership.releaseIfHumanEditedadopt-on-touch guards;ContextMemoryRepositorygainscancel + cascadeOntologyhooks on soft/hard delete and a restore hook.Confidence Score: 3/5
The new ontology pipeline has two correctness gaps in OntologyReconciler that should be addressed before merging.
Glossary minting in
resolveOrMintByNamelacks the collision-resistant precheck that was explicitly retrofitted onto term and metric creation in previous rounds. In a multi-node deployment, two concurrent derivation runs that both need to mint the same new glossary name will race; the loser'screateInternalthrows, is caught byreconcileSafely, stamps the content hash, and permanently abandons that memory's derivation with no user-visible signal. Additionally, agent-minted glossaries carryprovider=AUTOMATIONbut are never tracked viaDERIVED_FROMedges and are omitted fromonMemoryDeleted, so empty agent-owned glossaries accumulate indefinitely when memories are deleted.OntologyReconciler.java — glossary mint collision handling and retirement on memory deletion.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant CM as ContextMemory (create/update) participant CMR as ContextMemoryRepository participant OPE as OntologyProcessingEngine participant OG as OntologyGrounding participant OE as OntologyExtractor (LLM) participant OR as OntologyReconciler participant GTR as GlossaryTermRepo participant MR as MetricRepository participant GR as GlossaryRepository CM->>CMR: postCreate / postUpdate CMR->>OPE: schedule(memoryId) [if agent enabled] Note over OPE: quiet period (5 min debounce) OPE->>CMR: get(memoryId) OPE->>OPE: hashOf(memory) — skip if unchanged OPE->>OG: fetchCandidates(memory) OG-->>OPE: OntologyContext (terms, metrics, glossaries) OPE->>OE: derive(memory, context) OE-->>OPE: OntologyDerivation (termVerdict, metricVerdict) alt REUSE verdict OPE->>OR: reconcile(...) OR->>GTR: addRelationship(RELATED_TO) else CREATE verdict OPE->>OR: reconcile(...) OR->>GR: resolveOrMintGlossary OR->>GTR: createInternal + addRelationship(DERIVED_FROM) OR->>MR: createInternal + addRelationship(DERIVED_FROM) else SKIP verdict OPE->>OR: reconcile(...) Note over OR: no-op (protects against LLM failure) end OPE->>CMR: stampOntologyStats(hash) → postUpdate → re-schedule Note over OPE: next run exits via hash-gate (unchanged) CM->>CMR: delete(memoryId) CMR->>OPE: cancel(memoryId) CMR->>OR: onMemoryDeleted(CASCADE/ORPHAN/DEPRECATE) OR->>GTR: retire owned terms OR->>MR: retire owned metrics Note over OR: ⚠ agent-minted Glossary not retired%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant CM as ContextMemory (create/update) participant CMR as ContextMemoryRepository participant OPE as OntologyProcessingEngine participant OG as OntologyGrounding participant OE as OntologyExtractor (LLM) participant OR as OntologyReconciler participant GTR as GlossaryTermRepo participant MR as MetricRepository participant GR as GlossaryRepository CM->>CMR: postCreate / postUpdate CMR->>OPE: schedule(memoryId) [if agent enabled] Note over OPE: quiet period (5 min debounce) OPE->>CMR: get(memoryId) OPE->>OPE: hashOf(memory) — skip if unchanged OPE->>OG: fetchCandidates(memory) OG-->>OPE: OntologyContext (terms, metrics, glossaries) OPE->>OE: derive(memory, context) OE-->>OPE: OntologyDerivation (termVerdict, metricVerdict) alt REUSE verdict OPE->>OR: reconcile(...) OR->>GTR: addRelationship(RELATED_TO) else CREATE verdict OPE->>OR: reconcile(...) OR->>GR: resolveOrMintGlossary OR->>GTR: createInternal + addRelationship(DERIVED_FROM) OR->>MR: createInternal + addRelationship(DERIVED_FROM) else SKIP verdict OPE->>OR: reconcile(...) Note over OR: no-op (protects against LLM failure) end OPE->>CMR: stampOntologyStats(hash) → postUpdate → re-schedule Note over OPE: next run exits via hash-gate (unchanged) CM->>CMR: delete(memoryId) CMR->>OPE: cancel(memoryId) CMR->>OR: onMemoryDeleted(CASCADE/ORPHAN/DEPRECATE) OR->>GTR: retire owned terms OR->>MR: retire owned metrics Note over OR: ⚠ agent-minted Glossary not retiredReviews (4): Last reviewed commit: "fix(ui): align AISettingsPage to codegen..." | Re-trigger Greptile
Summary by Gitar
AISettingsand addedMcpChatServiceHolderfor runtime toggling without application re-installation.AISettingsPageto manage memory extraction and ontology derivation toggles, including MCP chat and server configurations.MemoryStatusBadgeandDerivedOntologyCardto track and visualize derivation provenance and processing errors.derivedFromlinks on Glossary Term and Metric detail pages.Ontologycomponents toMemorydomain for consistency.MemoryProcessingEngineto handle debounced ontology derivation with hash-gate recursion protection.MemoryReconcilerto manage entity ownership lifecycles (provider=automationvs user-adopted).MemoryAgentIT,AISettingsResourceIT) to validate lifecycle hooks and configuration persistence.This will update automatically on new commits.