Repository navigation
Fixes #36957: Let extracted memories await review and keep every value a document gives - #36988
Conversation
Release testing found every document-extracted memory created Approved and conflicting values settled silently: extraction deduplicated pills by question alone and the prompt let the model merge or pick values. - ContextMemoryExtractor takes the status pills start in; OSS keeps Approved. - Re-extraction maintains Unprocessed pills too, and a changed fact takes the status it was derived in. - Extracted memories are owned by their source's owners. - Dedupe by question and answer; the prompt asks for one candidate per value. ADR:2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s when they run Self-review of the extraction change found: - Same-question fallback paired pills by list order and could hand a value a reviewer superseded to its Approved sibling. Re-extraction now matches exact question and answer first, then by similarity that never pairs conflicting numbers; deduplication keeps a second answer only when its numbers conflict. - Copying the source's owners onto pills kept them readable after the source changed hands. Pills stay writer-owned; a conflict review over one is also assigned to whoever owns its source when the review opens. - Pills carried their derive time, which a reconciliation watermark could pass before they committed. Writes are stamped when they run, and updates are conditional so a review decided during re-extraction wins. - The ADR is corrected and the two older records amended. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g, assign the disputed source's owners Re-review found an added or dropped number (a section, a year) counted as a new value, hard-deleting reworded pills and reopening settled reviews; a person's correction let the document's old value be recreated beside it; and the disputed side of a conflict review never got its source's owners, because it is read without its source. - Numbers conflict only when neither answer's numbers contain the other's. - A Manual pill keeps claiming its best same-question candidate. - Review lookups read the source of a memory read without one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…raction record Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s claim only what is left - Extracted pills claim their rewordings before a pill a person corrected, which claims the document's value only when exactly one is left, so a correction can no longer swallow another value of the same fact. - Numbers compare by value: "1,500" and "1500", "2.50" and "2.5" agree. - Only a changed question or answer takes the derived stage; a reworded title or summary keeps an Approved pill Approved, and keeps a shared pill linked. ADR:2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values Co-Authored-By: Claude Opus 5.5 <[email protected]>
…itations are not values
- A corrected pill counted candidates of every question, so a sibling fact
("contractors get 5 days") kept it from claiming its own and the document's
value came back beside the correction; with only the sibling derived, the
correction swallowed it. It now counts only candidates asking its question.
- A section, page or chapter citation is no value: renumbering sections no
longer releases and recreates settled values. The prompt names a value's
section in its summary, and fact identity ignores citations.
- Numbers keep trailing zeros ("3.10" is not "3.1"), and cross-source duplicate
linking uses the same number rule as re-extraction.
ADR:2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e only parenthesized citations
- A corrected pill compared questions as exact strings, so "What's the refund
window?" no longer matched "What is the refund window?" and the document's
value came back beside the correction. Questions now match on their
vocabulary.
- Citation stripping ate real values outside parentheses ("Section 3 – 25
days", "Results per page 50"). Only a parenthesized citation is set aside
now, and it covers tables, articles, figures, annexes and schedules too.
- The prompt keeps a value's section out of the question as well as the answer.
ADR:2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sameQuestion dropped every word under three letters, so questions differing
only in UK/US or Q3/Q4 counted as one and a person's correction swallowed the
other fact's changed value. Every word now counts except filler a rewording
adds or drops. Parenthesized citations again cover "sec.", spaced page ranges
and "&" lists, and a zero fraction is no new value ("1,500.00" is "1500").
ADR:2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values
Co-Authored-By: Claude Opus 5.5 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
Keep signed values separate and prevent a manual correction from consuming another question with the same answer. Preserve both extraction prompt rules across the companion branches.
Require reviewed pills to match their own question, including significant word order. Otherwise rejected claims and reversed-direction corrections can silently consume another fact with an equal answer.
…r tests Both PRs added tests at the same spot, so whichever merged second conflicted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A reworded question fails sameQuestion, so a Rejected or Superseded pill claimed nothing, was hard-deleted with its only source link, and its value came back in the derived stage (Approved in OSS). A pill a person decided now stays for its review, and a derived value resembling it that it cannot claim starts Unprocessed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
"(2025)" is no citation, so the old case pinned the added-number rule; it is renamed to say so, and a renumbered "(section N)" case covers citations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A reworded question carrying the document's original number cannot be claimed by the correction, so it was recreated in its derived stage (Approved in OSS) beside it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A decided pill matched exactly never held its look-alikes, and a second rewording of its own question was never held. Holds now run once after both passes for every Draft or decided pill. Draft awaits a review, so it is released again when its fact leaves the source. Beside a correction a changed number is held only when the questions alone clear the bar, since number-only answers always look alike. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| private static Set<String> topicWords(String question) { | ||
| return tokenize(question).stream() | ||
| .filter(word -> !FILLER.contains(word) && !QUESTION_FRAME.contains(word)) | ||
| .map(MemoryTextSimilarity::singular) | ||
| .collect(Collectors.toSet()); | ||
| } |
There was a problem hiding this comment.
💡 Edge Case: questionSimilarity ignores short words, so a UK correction holds the US value
topicWords builds on tokenize, and tokenize drops every token shorter than 3 characters. So "…employees in the UK get?" and "…employees in the US get?" end up with the same topic set and score 1.0, and the same goes for Q3/Q4 and EU/US. sameQuestion was written to tell these apart (its javadoc says "UK" is not "US" and "Q3" is not "Q4").
The UK and US answers "28 days" and "20 days" also tokenize to just {days}, so the pair clears the weighted bar. Taken together, a Manual UK correction now marks a conflicting US value as questionsAlike, and resembles holds it as Unprocessed. In aCorrectionNeverTakesTheValueOfAQuestionDifferingInAShortWord, the US "20 days" is now created Unprocessed instead of Approved. Under OSS it stops grounding answers until an admin approves it. The test passes only because it checks the answer and not the status.
Fix: build topic words from a tokenizer that keeps short words, like the split in questionWords, and add a status assertion to that test.
Keep short words (UK/US, Q3/Q4) when comparing question topics:
private static Set<String> topicWords(String question) {
return questionWords(question).stream()
.filter(word -> !QUESTION_FRAME.contains(word))
.map(MemoryTextSimilarity::singular)
.collect(Collectors.toSet());
}
Was this helpful? React with 👍 / 👎
The edit modal stores a correction's text as question and answer, so the value it replaced can score under the identity bar as a pair. A conflicting value beside a correction is now held whenever the questions alone clear the bar, checked over every unclaimed value. Two questions without a topic word the measure reads (another script, "What is Q3?") are no longer alike. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Review 👍 Approved with suggestions 1 closed / 2 findings🔴 High risk · Reworks memory reconciliation and review status, so incorrect claim matching could overwrite or release facts and let conflicting values ground answers unreviewed. Adds reviewable extraction for Context Center memories and keeps every conflicting document value as its own memory, so re-extraction no longer silently merges or settles conflicts. Reworded questions no longer leave rejected or superseded pills undone in review.
💡 Edge Case: questionSimilarity ignores short words, so a UK correction holds the US value📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/MemoryTextSimilarity.java:127-132 📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/ContextMemoryReconciler.java:181-183 📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/ContextMemoryReconciler.java:313-314
The UK and US answers "28 days" and "20 days" also tokenize to just {days}, so the pair clears the weighted bar. Taken together, a Manual UK correction now marks a conflicting US value as Fix: build topic words from a tokenizer that keeps short words, like the split in Keep short words (UK/US, Q3/Q4) when comparing question topics✅ 1 closed✅ Bug: Reworded question now deletes a rejected/superseded pill, undoing review
🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…m other readers (#36989) * Show and count only the memories a Context Center listing caller may read Release testing found the Memories page showing a reader another user's Shared memory awaiting review, and an admin another user's Draft; the plain list also kept a paging.total that counted memories the caller cannot see. Document extraction kept a person's contact details, which chat capture never saves. - A listing asking for Unprocessed or Draft gets them for the caller's own memories only, admins included, as a search asking for them already did. - A list page that hides rows reports the total of memories the caller may read, counted over at most 10,000 rows. - The extraction prompt forbids personal data and credentials, like capture. ADR:2026-11-03-context-center-listings-show-and-count-only-what-the-caller-may-read ADR:2026-11-03-document-extraction-keeps-no-personal-data Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(context-memory): list another's Unprocessed memory to no one; Draft keeps the share rules The listing rule from the previous commit made Draft owner-only too, which hid evidence holds (Draft with no review task) from the reviewers and readers that Draft as the review queue relies on. Only a person's Unprocessed memory is now listed to its owners alone, admins included; a document's pills and every other stage keep the share rules. The plain list applies the same rule (ContextMemoryVisibility.isListedToOwnersOnly) as the search-backed listing. paging.total is now recounted whenever the database counted more rows than the page shows, not only when this page hid a row, so a count-only call and a page without hidden rows no longer count memories the caller cannot list. ADR:2026-11-03-context-center-listings-show-and-count-only-what-the-caller-may-read amends ADR:2026-10-15-search-admits-a-subjects-own-pending-memories-on-request Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(context-memory): pending memories list to owners and admins; non-admin creates start Unprocessed Item 15: an Unprocessed or Draft memory is listed only to its owners and to admins, on the search-backed listing, the plain list and the per-document cards. This replaces the previous commit's Unprocessed-only rule and its extraction exemption. The plain list also shows a document's pending pills to the document's owners, since the extractor, not the uploader, owns them. A read by id keeps the share rules. Item 18: a memory created by anyone but an admin or a bot starts Unprocessed, whatever entityStatus it requests. ContextMemoryRepository.prepare applies it on every create (POST, a PUT that creates, MCP create_entity), before the stage stamps a review, and keeps a hold for retired evidence. ADR:2026-11-03-context-center-listings-show-and-count-only-what-the-caller-may-read amends ADR:2026-10-15-search-admits-a-subjects-own-pending-memories-on-request, ADR:2026-10-15-a-memory-cites-its-supporting-queries-and-their-retirement-holds-it-for-review and ADR:2026-10-09-data-consumers-create-context-memories Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(context-memory): only an admin, a bot or a conflict review approves a memory Review finding: a Data Steward's create started Unprocessed, then a PATCH of /entityStatus approved it, grounding everyone's answers without review. ContextMemoryRepository.checkStageDecision now refuses (403) any move into Approved unless an admin or a bot writes it, or a conflict review decision does (the resolver writes as themselves through governance-bot). A PUT re-sends its create request, stage included, so it keeps the stored stage instead. Evidence holds, reconciliation, extraction, capture and upsertMemory are unaffected. An owner can no longer restore their own retired memory to Approved; the lifecycle ITs now assert that and restore as admin. Also: an admin's list skips the visible-total recount, since nothing is hidden from an admin, and a document's pending pills list to the members of a team that owns it (SubjectContext.isOwner). amends ADR:2026-10-09-data-consumers-create-context-memories Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(context-memory): only automation opens a conflict review; trust no requested hold Review finding: a non-admin could still approve their own memory through a conflict review. Anyone who may edit a memory could add disputes, the review is assigned to the owners of both sides, and its decision writes through governance-bot. New disputes are now accepted only from an admin, a bot, or a bot writing for a user (Collate's reconciliation writes them either way), on create and on update; anyone else gets a 403. The create rule no longer trusts a Draft that carries the evidence-hold text. It runs before the server's own hold, which still starts a memory citing a retired Query in Draft, and a PUT that creates now runs the POST create so it is prepared once. amends ADR:2026-10-09-data-consumers-create-context-memories Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(memory): retain both extraction rules * test(memory): cover pending REST visibility * test(memory): wait for indexed visibility fixtures * test(memory): use supported asset list filters * test(memory): await the selected lifecycle stages * test(memory): keep list search fixtures concise * fix(memory): approve OSS memories by default OSS has no reconciliation app or general approval UI. Keep review required as a repository policy that Collate selects explicitly, including its creation and owner approval restrictions. Preserve explicit OSS stages and existing memories. Keep ownership, provenance, visibility, and evidence checks in both distributions. * test(memory): keep the privacy prompt test clear of #36988's extractor tests Both PRs added tests at the same spot, so whichever merged second conflicted. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Describe your changes:
Fixes #36957
Memories extracted from Context Center files and articles were created Approved, and extraction settled conflicts silently. This PR lets a provider that reviews extracted memories start them Unprocessed; Collate does, while OSS keeps Approved. It also keeps every value a document gives for one fact as its own memory, for a reviewer. Re-extraction keeps reviewed facts and never pairs two values whose numbers conflict, and a conflict review over an extracted memory also goes to whoever owns its source.
Type of change:
High-level design:
ContextMemoryExtractor(LLMCompletionClient, ContextMemoryStatus initialStatus)sets the status extracted memories start in.MemoryTextSimilarity.hasConflictingNumbers).MemoryConflictReviewTasksalso assigns a conflict over an extracted memory to the current owners of its source.SemanticMemoryDuplicateFinderuses the same number rule.docs/decisions/2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values.md.2026-09-29-context-file-memory-reuse,2026-10-27-memory-reconciliation-resolves-comparisons-before-writes.Tests:
Use cases covered
Unit tests
a3b46531a2f: 137 tests passed, no failures or skips.ContextFileProcessingServiceTest,ContextMemoryExtractorTest,ContextMemoryReconcilerTest,FileContextProcessingEngineTest,MemoryConflictResolutionTest,MemoryConflictReviewTasksTest,MemoryTextSimilarityTest,PageContextProcessingEngineTest,SemanticMemoryDuplicateFinderTest.mvn spotless:applypassed. The Java impact map check passed.Backend integration tests
Not run locally:
make java_affectedselects 53 integration tests. Theopenmetadata-integration-testsmodule does not compile against the local snapshot jars, and its errors are in unrelated ontology and MCP ITs. The tests run in the merge queue.UI screen recording:
Not applicable: backend-only change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md: fresh review ofa3b46531a2ffound no remaining Important findings or test-map gaps. Fixed sign loss, reviewed memories consuming another question's value, and question-word ordering. Manual corrections continue to suppress re-extracted candidates for their own question.Regression follow-up (2026-11-04)
SemanticMemoryDuplicateFinderTestcases exercise the actual caller: opposite signs cannot reuse an approved fact; adding a citation does not prevent reuse of the same value.ab09a2af418a6530b57413268a2eaa4d5fbb8753, fresh REVIEW.md pass, no unanswered Important findings. Coverage findings were fixed before this pass.7d7ac24b6e4e274b935954a067dbae7fa61007a3, AIeacb39819e854615b6eebf27b6fa486b4b9beba3, Collatef10b2d235cd4ec4f461a2db409f43a9289d4e3ae. Targeted combined runs are reported here; this does not claim that every planner-selected integration or browser suite ran.Merge readiness (2026-11-06)
main(9e14a55), no conflicts.ContextMemoryReconcilerTest72,ContextMemoryRepositoryTest23,MemoryConflictReviewTasksTest22,ContextMemoryExtractorTest15,SemanticMemoryDuplicateFinderTest11,MemoryTextSimilarityTest8.🤖 Generated with Claude Code