Skip to content

Fixes #36957: Let extracted memories await review and keep every value a document gives - #36988

Merged
pmbrull merged 17 commits into
mainfrom
pmbrull/memory-doc-review
Nov 6, 2026
Merged

pmbrull merged 17 commits into
mainfrom
pmbrull/memory-doc-review

Conversation

@pmbrull

@pmbrull pmbrull commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

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:

  • Bug fix

High-level design:

  • Extractor:
    • ContextMemoryExtractor(LLMCompletionClient, ContextMemoryStatus initialStatus) sets the status extracted memories start in.
    • The prompt asks for one candidate per value, names its section in the summary, and forbids personal data. It matches Fixes #36958: Set OSS approval defaults and hide pending memories from other readers #36989 so merging either branch second keeps both rules.
    • Dedupe keeps a second answer to a question when its numbers conflict with every kept answer.
  • Reconciler:
    • Re-extraction first matches by exact question and answer, then by similarity, and never pairs answers whose numbers conflict (MemoryTextSimilarity.hasConflictingNumbers).
    • Numbers conflict only when one answer replaces a number of the other. Signs are preserved (including Unicode minus); grouping commas and leading zeros are normalized. Parenthesized citations such as "(section 3)" and "(Table 4)" are not values.
    • Extracted pills claim their rewordings before a pill a person corrected (Manual) does. The correction then takes the document's value for its own question, matched by significant words in their original order, only when exactly one is left. Reviewed extracted memories also consume candidates only for their own question.
    • Only a changed question or answer resets a pill to the stage it was derived in; a reworded title or summary keeps the stage.
    • Writes are stamped when they run and updates are conditional, so a review decided during re-extraction wins.
  • Reviews: MemoryConflictReviewTasks also assigns a conflict over an extracted memory to the current owners of its source.
  • Duplicate finder: SemanticMemoryDuplicateFinder uses the same number rule.
  • Records:
    • New: docs/decisions/2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values.md.
    • Amended: 2026-09-29-context-file-memory-reuse, 2026-10-27-memory-reconciliation-resolves-comparisons-before-writes.
  • Counterpart: open-metadata/openmetadata-collate#8239 reconciles these memories. It needs this PR first, because it calls the two-argument constructor.

Tests:

Use cases covered

  • A document giving 15% (Sales) and 25% (HR) yields two memories, never a merged answer.
  • Re-extracting an edited document:
    • keeps an unchanged fact's id and stage
    • treats a replaced number as a new claim
    • doesn't reopen a settled conflict when sections are renumbered
    • lets a person's correction keep the document's value from coming back, without taking another fact's value
  • A conflict review over a document's memory goes to whoever owns the document now.

Unit tests

  • Current head a3b46531a2f: 137 tests passed, no failures or skips.
  • Classes: ContextFileProcessingServiceTest, ContextMemoryExtractorTest, ContextMemoryReconcilerTest, FileContextProcessingEngineTest, MemoryConflictResolutionTest, MemoryConflictReviewTasksTest, MemoryTextSimilarityTest, PageContextProcessingEngineTest, SemanticMemoryDuplicateFinderTest.
  • Regressions were observed failing before their fixes: signed numeric values, Manual UK/US claims sharing an answer, reviewed UK/US claims across all six protected stages, and reversed USD/EUR direction.
  • mvn spotless:apply passed. The Java impact map check passed.

Backend integration tests

Not run locally: make java_affected selects 53 integration tests. The openmetadata-integration-tests module 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:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review against REVIEW.md: fresh review of a3b46531a2f found 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.
  • Existing limitations: a lost-race write can still count as updated in extraction statistics; this does not overwrite the reviewed memory.
  • Decision check: the records above.

Regression follow-up (2026-11-04)

  • Two new SemanticMemoryDuplicateFinderTest cases exercise the actual caller: opposite signs cannot reuse an approved fact; adding a citation does not prevent reuse of the same value.
  • Combined OpenMetadata memory/governance unit run: 240 passed, including all 10 duplicate-finder cases. Formatting and branch impact ownership passed.
  • Self-review: ab09a2af418a6530b57413268a2eaa4d5fbb8753, fresh REVIEW.md pass, no unanswered Important findings. Coverage findings were fixed before this pass.
  • Runtime evidence: all 12 pinned PR heads are present in the combined stack; source heads: OpenMetadata 7d7ac24b6e4e274b935954a067dbae7fa61007a3, AI eacb39819e854615b6eebf27b6fa486b4b9beba3, Collate f10b2d235cd4ec4f461a2db409f43a9289d4e3ae. Targeted combined runs are reported here; this does not claim that every planner-selected integration or browser suite ran.

Merge readiness (2026-11-06)

  • Merged main (9e14a55), no conflicts.
  • Review fixes, ADR updated:
    • Re-extraction never releases a memory a person decided.
    • A Draft still awaiting review is released when its source drops the fact.
    • A value that resembles a decided memory starts Unprocessed, whatever stage extraction derives, so a value a reviewer rejected or replaced never returns to grounding unreviewed.
    • Beside a correction this also covers a different number when the questions alone match.
    • The edit modal saves the edited text as both question and answer, so the question test applies on its own (fab9651).
    • Commits: fea58c1, 2800c6d, 9c72592, fab9651. Citation-stripping test: 11a670b.
  • Tests:
    • 151 targeted unit tests pass: ContextMemoryReconcilerTest 72, ContextMemoryRepositoryTest 23, MemoryConflictReviewTasksTest 22, ContextMemoryExtractorTest 15, SemanticMemoryDuplicateFinderTest 11, MemoryTextSimilarityTest 8.
    • Each new reconciler case fails without its fix.
  • Self-review: fresh REVIEW.md reviews of the final-adjustment commits and of each fix round. The last round found no remaining Critical or Important issues.

Merge order (12 memory PRs). OpenMetadata #36988 first, then #36990 and #36992 in any order, then #36989 (it needs #36988). Right after #36989: Collate #8241, then #8239. Until #8241 lands, Collate main starts a memory created without a stage Approved. Collate #8240 and #8242 can merge any time. OpenMetadata #36991 goes last of the OpenMetadata PRs, after one update once #36989 and #36992 land; its conflicts are already resolved. ai-platform #2035 and #2036 can merge any time. #2034 goes after Collate #8239 and #8241, with one update after #2035, also already resolved.

🤖 Generated with Claude Code

pmbrull and others added 8 commits November 3, 2026 11:48
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]>
…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]>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:49
@pmbrull
pmbrull requested a review from a team as a code owner November 3, 2026 19:49
@pmbrull
pmbrull requested a review from IceS2 November 3, 2026 19:49

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 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 Nov 3, 2026
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.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 22:23

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 4, 2026 16:22

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 16:29

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

pmbrull added a commit that referenced this pull request Nov 5, 2026
…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]>
pmbrull and others added 2 commits November 5, 2026 19:26
"(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]>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 20:14

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

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]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 06:24

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment on lines +127 to +132
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());
}

@gitar-bot gitar-bot Bot Nov 6, 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.

💡 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]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 06:54

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown
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.

  • Open minor issue: questionSimilarity drops words shorter than 3 characters, so a UK correction can mark a US value as alike and hold it Unprocessed. Build topic words with a tokenizer that keeps short words and add a status assertion to aCorrectionNeverTakesTheValueOfAQuestionDifferingInAShortWord.
💡 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

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());
}
✅ 1 closed
✅ Bug: Reworded question now deletes a rejected/superseded pill, undoing review

📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/ContextMemoryReconciler.java:221-231 📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/ContextMemoryReconciler.java:342-348 📄 openmetadata-service/src/main/java/org/openmetadata/service/context/center/MemoryTextSimilarity.java:102-112 📄 docs/decisions/2026-11-03-extracted-memories-can-await-review-and-keep-conflicting-values.md:41-43
The new filter in removeMostSimilar (lines 224-226) lets a pill outside Approved/Unprocessed claim a candidate only when sameQuestion holds, and sameQuestion is now order-sensitive and counts every non-filler word. The model often rewords questions between runs. rephrasedQuestionKeepsThePillInsteadOfChurningIt shows a real case, and even "Discount?" vs "What is the discount?" fails because what is not filler. In that case a REJECTED or SUPERSEDED extracted pill finds no match. Because isAutomated is true, planSimilarMatches then calls planRelease, which hard-deletes it when it has no other source, and planNewMemories recreates the same value in the derived stage (Approved in OSS). The reviewer's rejection is lost, and a fact they rejected grounds answers again. The same ADR says re-extraction must not undo a reviewer's decision ("keep reviewed facts through rewording").

Fix: guard against another question's equal value without dropping the pill. Let a reviewed pill still claim a non-conflicting reworded candidate. When its best match fails sameQuestion, leave the candidate unclaimed but keep the reviewed pill (skip planRelease for non-engine-managed pills). Add a test where a REJECTED pill's question is reworded and check that it is neither released nor recreated.

🤖 Prompt for agents
Code Review: 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.
  
  - Open minor issue: `questionSimilarity` drops words shorter than 3 characters, so a UK correction can mark a US value as alike and hold it Unprocessed. Build topic words with a tokenizer that keeps short words and add a status assertion to `aCorrectionNeverTakesTheValueOfAQuestionDifferingInAShortWord`.

1. 💡 Edge Case: questionSimilarity ignores short words, so a UK correction holds the US value
   Files: 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

   `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.

   Fix (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());
   }

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

Compact
gitar display:verbose         

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

@pmbrull
pmbrull merged commit ef22515 into main Nov 6, 2026
69 of 71 checks passed
@pmbrull
pmbrull deleted the pmbrull/memory-doc-review branch November 6, 2026 08:42
pmbrull added a commit that referenced this pull request Nov 6, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.1 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.

Context Center extraction: memories skip review and conflicting document values are merged or dropped

3 participants