[PR #1456] [MERGED] fix(long-term-memory): record the reconciliation outcome for every candidate group (1.4.51) #1471

Closed
opened 2026-10-21 05:11:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1456
Author: @Promansis
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @Promansis

Base: staging ← Head: fix(long-term-memory)/1449-reconciliation-outcome-counts


📝 Commits (2)

  • d310217 fix(long-term-memory): record the reconciliation outcome for every candidate group (#1449)
  • e31849f Merge upstream/staging into fix(long-term-memory)/1449-reconciliation-outcome-counts; release long-term-memory 1.4.51

📊 Changes

15 files changed (+183 additions, -78 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.51.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+15 -15)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/candidate-reconciliation.ts (+38 -4)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts (+14 -18)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-candidate-reconciliation.regression.ts (+22 -1)
📝 tests/long-term-memory-reconciliation-recall.regression.ts (+50 -0)

📄 Description

Linked issue

Closes #1449

Why this change

Candidate reconciliation decides, for every non-character candidate group, whether it reuses an existing memory, creates a new one, or leaves it for review. Only matches and warnings were recorded. The "matched nothing, so create" outcome is the path that makes duplicates, and it left no trace, so the duplicate rate could not be read from the debug log. This is tracker item EX-I3 (extraction stages audit F4 part 1).

What changed

 reconcileEvidenceUnitCandidates                       # candidate-reconciliation.ts
   for each candidate group
     no retrieved candidates          → continue
+                                       counts.created++
     one plausible, complete window   → remap
-                                       matches.push({ derivedNoteId, noteId })
+                                       matches.push({ derivedNoteId, noteId, matchKind })
+                                       counts.matched++
     one plausible, incomplete window → warn  + counts.incomplete++
     several plausible                → warn  + counts.ambiguous++
     candidates, incomplete window    → warn  + counts.incomplete++
     none plausible, complete window  → (nothing)
+                                       counts.created++
+  return { …, counts: { groups, matched, created, ambiguous, incomplete } }

 extractLongTermMemoryFromSourceNoteInner              # source-extraction.ts
-  if (remaps.size > 0 || diagnostics.length > 0)
-    record candidate_reconciliation { reconciledNotes, ambiguousCandidates }
+  record candidate_reconciliation { counts }          # every source
+    status: warning when ambiguous + incomplete > 0, else ok
  • Every group lands in exactly one bucket, so groups = matched + created + ambiguous + incomplete. matchKind (identity or content) was already computed for the warning details; matches now carry it too.
  • reconciledNotes and ambiguousCandidates are gone. Nothing else in the package or tests reads them.
  • long-term-memory 1.4.51: CHANGELOG entry, version, manifest, rebuilt server.mjs, artifact and catalog entries. At land, the branch was merged with upstream/staging (1.4.50, #1455). Only the CHANGELOG conflicted, and reland resolved it.

Diff: source +52/−22 lines, tests +72/−1, CHANGELOG +4, before the release merge.

Known limit: created also counts a group whose derived id already exists as a memory. Reconciliation excludes that memory, and the compiler updates it later, so the create rate reads slightly high. A sixth bucket for that case is beyond the Minimal fix and is left as an owner's call before EX-I10.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none to stored memories. With debug logging on, a batch import now writes one reconciliation entry per source, so the 200-entry Debug view turns over sooner.
  • Merge danger: two-way door. It only changes what the debug log records. Matching, remaps and drafts are unchanged. A revert restores the old conditional entry. Blast radius: debug log entries for candidate reconciliation.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

These checks were run by the coding agent, not by a person. Engine checkout 2039583ca (v2.4.6-2323), Node v24.15.0.

  • Regressions added:
    • tests/long-term-memory-reconciliation-recall.regression.ts: a create-only preparation (one timeline candidate, no timeline memories) records exactly one candidate_reconciliation entry, status ok, counts { groups: 1, created: 1 }. It failed on the unfixed source, which recorded no entry.
    • tests/long-term-memory-candidate-reconciliation.regression.ts: counts for identity match, likely create, ambiguous, and both incomplete paths, with the bucket-sum invariant. Matches carry matchKind identity or content.
  • On source commit d3102175c, these passed: the two regressions above (run directly, because test-ltm.sh does not list them), test-ltm.sh extraction-reliability, debug-log, routes-drafts and debug-activity, npm run check, git diff --check and the four catalog gates.
  • On release HEAD e31849f5f (after merging 1.4.50), these all passed:
    • A package rebuild, which left the tree clean, so the committed outputs match the source.
    • test-fast.sh (npm run check, git diff --check) and typecheck-packages long-term-memory.
    • test-catalog-lanes, validate-package-locales, validate-catalog and catalog-release-notes.
    • test-ltm.sh extraction-reliability, debug-log, debug-activity, routes-drafts and extraction-graph, plus candidate-reconciliation and reconciliation-recall.
  • Not done: a live import in Engine to read the entry in Activity → Debug.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

None. The Debug view lists the new entry with the existing "Candidate reconciliation" label; nothing else changes on screen.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a “Candidate reconciliation” debug-log entry for every extraction, with counts for matched, created, ambiguous, and incomplete candidate groups. The entry is available in Copy JSON.
    • Debug entries show a warning when any candidates are ambiguous or incomplete; otherwise, they show an OK status.
  • Updates
    • Updated Long-Term Memory to version 1.4.51.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/1456 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/1449-reconciliation-outcome-counts` --- ### 📝 Commits (2) - [`d310217`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d3102175cc64e459e1d54a3ce1a0a7bf2ab7f6a9) fix(long-term-memory): record the reconciliation outcome for every candidate group (#1449) - [`e31849f`](https://github.com/Pasta-Devs/Marinara-Agents/commit/e31849f5f0e91167aec24b2dcbbf0f8740675707) Merge upstream/staging into fix(long-term-memory)/1449-reconciliation-outcome-counts; release long-term-memory 1.4.51 ### 📊 Changes **15 files changed** (+183 additions, -78 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.51.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+15 -15) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/candidate-reconciliation.ts` (+38 -4) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts` (+14 -18) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-candidate-reconciliation.regression.ts` (+22 -1) 📝 `tests/long-term-memory-reconciliation-recall.regression.ts` (+50 -0) </details> ### 📄 Description ## Linked issue Closes #1449 ## Why this change Candidate reconciliation decides, for every non-character candidate group, whether it reuses an existing memory, creates a new one, or leaves it for review. Only matches and warnings were recorded. The "matched nothing, so create" outcome is the path that makes duplicates, and it left no trace, so the duplicate rate could not be read from the debug log. This is tracker item EX-I3 (extraction stages audit F4 part 1). ## What changed ```diff reconcileEvidenceUnitCandidates # candidate-reconciliation.ts for each candidate group no retrieved candidates → continue + counts.created++ one plausible, complete window → remap - matches.push({ derivedNoteId, noteId }) + matches.push({ derivedNoteId, noteId, matchKind }) + counts.matched++ one plausible, incomplete window → warn + counts.incomplete++ several plausible → warn + counts.ambiguous++ candidates, incomplete window → warn + counts.incomplete++ none plausible, complete window → (nothing) + counts.created++ + return { …, counts: { groups, matched, created, ambiguous, incomplete } } extractLongTermMemoryFromSourceNoteInner # source-extraction.ts - if (remaps.size > 0 || diagnostics.length > 0) - record candidate_reconciliation { reconciledNotes, ambiguousCandidates } + record candidate_reconciliation { counts } # every source + status: warning when ambiguous + incomplete > 0, else ok ``` - Every group lands in exactly one bucket, so `groups = matched + created + ambiguous + incomplete`. `matchKind` (`identity` or `content`) was already computed for the warning details; matches now carry it too. - `reconciledNotes` and `ambiguousCandidates` are gone. Nothing else in the package or tests reads them. - `long-term-memory` 1.4.51: CHANGELOG entry, version, manifest, rebuilt `server.mjs`, artifact and catalog entries. At land, the branch was merged with `upstream/staging` (1.4.50, #1455). Only the CHANGELOG conflicted, and reland resolved it. Diff: source +52/−22 lines, tests +72/−1, CHANGELOG +4, before the release merge. Known limit: `created` also counts a group whose derived id already exists as a memory. Reconciliation excludes that memory, and the compiler updates it later, so the create rate reads slightly high. A sixth bucket for that case is beyond the Minimal fix and is left as an owner's call before EX-I10. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none to stored memories. With debug logging on, a batch import now writes one reconciliation entry per source, so the 200-entry Debug view turns over sooner. - **Merge danger:** two-way door. It only changes what the debug log records. Matching, remaps and drafts are unchanged. A revert restores the old conditional entry. Blast radius: debug log entries for candidate reconciliation. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes These checks were run by the coding agent, not by a person. Engine checkout `2039583ca` (`v2.4.6-2323`), Node `v24.15.0`. - **Regressions added:** - `tests/long-term-memory-reconciliation-recall.regression.ts`: a create-only preparation (one timeline candidate, no timeline memories) records exactly one `candidate_reconciliation` entry, status `ok`, counts `{ groups: 1, created: 1 }`. It failed on the unfixed source, which recorded no entry. - `tests/long-term-memory-candidate-reconciliation.regression.ts`: counts for identity match, likely create, ambiguous, and both incomplete paths, with the bucket-sum invariant. Matches carry `matchKind` `identity` or `content`. - On source commit `d3102175c`, these passed: the two regressions above (run directly, because `test-ltm.sh` does not list them), `test-ltm.sh` `extraction-reliability`, `debug-log`, `routes-drafts` and `debug-activity`, `npm run check`, `git diff --check` and the four catalog gates. - On release HEAD `e31849f5f` (after merging 1.4.50), these all passed: - A package rebuild, which left the tree clean, so the committed outputs match the source. - `test-fast.sh` (`npm run check`, `git diff --check`) and `typecheck-packages long-term-memory`. - `test-catalog-lanes`, `validate-package-locales`, `validate-catalog` and `catalog-release-notes`. - `test-ltm.sh` `extraction-reliability`, `debug-log`, `debug-activity`, `routes-drafts` and `extraction-graph`, plus `candidate-reconciliation` and `reconciliation-recall`. - Not done: a live import in Engine to read the entry in Activity → Debug. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) None. The Debug view lists the new entry with the existing "Candidate reconciliation" label; nothing else changes on screen. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a “Candidate reconciliation” debug-log entry for every extraction, with counts for matched, created, ambiguous, and incomplete candidate groups. The entry is available in Copy JSON. * Debug entries show a warning when any candidates are ambiguous or incomplete; otherwise, they show an OK status. * **Updates** * Updated Long-Term Memory to version 1.4.51. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:11:50 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1471
No description provided.