[PR #1097] [MERGED] fix(long-term-memory): reconcile against commits after the extraction snapshot (1.3.24) #1290

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1097
Author: @Promansis
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/27/2026
Merged by: @Promansis

Base: staging ← Head: fix(long-term-memory)/1087-commit-time-reconciliation


📝 Commits (2)

  • 5833128 fix(long-term-memory): reconcile against commits after the extraction snapshot (1.3.24) (#1087)
  • 56b2865 fix(long-term-memory): hold one vault lock across the batch commit loop (#1087)

📊 Changes

15 files changed (+947 additions, -215 deletions)

View changed files

➕ artifacts/long-term-memory-1.3.24.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 (+5 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+38 -38)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/candidate-reconciliation.ts (+58 -33)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts (+81 -45)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-processing.ts (+113 -59)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-extraction-reliability.regression.ts (+612 -0)

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #1087

Why this change

  • Importing several sources in one batch, or running two imports at the same time, could create a duplicate memory. Candidate reconciliation matched against the recall snapshot captured before the provider call, so a compatible target committed after that snapshot (a sibling batch item or a concurrent import) was invisible and the second source created a new note under a different ID.
  • A stale batch projection could also revive an archived or resolved memory as a reconciliation target and mutate a note that is no longer an active recall target.

What changed

  • packages/long-term-memory 1.3.23 → 1.3.24 (manifest, rebuilt server.mjs, artifacts/long-term-memory-1.3.24.zip, catalog lanes and notes.json release note).
  • candidate-reconciliation.ts: a commit-time caller may supply the complete fresh candidate set; matching against a complete set is authoritative, so a singleton match is safe to reuse. Candidate notes exclude archived and resolved memories so a terminal note is never a target.
  • source-extraction.ts: extraction now returns a recompile that re-runs the vault-derived stages against a caller-supplied candidate set without repeating the provider call.
  • source-processing.ts: commit recompiles against the fresh vault plus the batch overlay. The by-id merge keeps one candidate per note, and the overlay yields to a durable archived/resolved status so a stale active projection cannot revive a terminal note. A failed fresh scan falls back to the preparation snapshot.
  • scripts/build-feature-packages.mjs: version bump to 1.3.24.
  • tests/long-term-memory-extraction-reliability.regression.ts: regressions for same-batch reuse, reuse of a note committed during the provider call, the archived-target case, the duplicate durable/overlay case, and the terminal-overlay case.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none — engine.min (2.4.1) and engine.maxExclusive (4.0.0) unchanged.
  • New or changed permissions/entrypoints: none — permissions (agent-runtime, chat-read, chat-write, routes, storage, ui) and entrypoints unchanged.
  • Restart, storage, update, or uninstall impact: none — no stored-data migration and no change to vault or draft formats; restartRequired unchanged.

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

Executed as agent evidence on the pushed revision 583312847882307706ff7d7449c14f53588e5196; a human must re-verify before ticking any box above.

  • LTM tsx regressions all pass: candidate-reconciliation, reconciliation-recall, extraction-graph, runtime, routes-imports, routes, storage, local-characters, extraction-reliability, installation (exact 1.3.24 ZIP install, offline restart, backup inclusion, uninstall/reinstall, durable-byte preservation).
  • tests/long-term-memory-loading.regression.mjs passes.
  • npm run check (0 errors, 849 pre-existing warnings), git diff --check, node scripts/typecheck-packages.mjs long-term-memory, node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-catalog.mjs (38 packages; v2=38, v3=38; legacy=v2) and node scripts/tests/catalog-release-notes.regression.mjs all pass.
  • The terminal-overlay regression was confirmed to fail on the pre-fix code (the second source targeted the archived note) and pass after the fix.
  • Not run locally: browser and lifecycle Playwright suites and hosted CI.

Documentation impact

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

UI evidence (if applicable)

Not applicable — no client or UI change.

Summary by CodeRabbit

  • Bug Fixes
    • Concurrent and multi-source imports now reuse a compatible memory created or committed after extraction, avoiding duplicate memories.
    • Archived or resolved memories are no longer selected as reconciliation targets, even when a batch view shows outdated status.
    • Ambiguous or incomplete reconciliation now requires review rather than applying an uncertain match.
  • Release
    • Long-Term Memory updated to version 1.3.24.

🔄 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/1097 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/1087-commit-time-reconciliation` --- ### 📝 Commits (2) - [`5833128`](https://github.com/Pasta-Devs/Marinara-Agents/commit/583312847882307706ff7d7449c14f53588e5196) fix(long-term-memory): reconcile against commits after the extraction snapshot (1.3.24) (#1087) - [`56b2865`](https://github.com/Pasta-Devs/Marinara-Agents/commit/56b2865b551549f492999697508c7d83e5f50c6a) fix(long-term-memory): hold one vault lock across the batch commit loop (#1087) ### 📊 Changes **15 files changed** (+947 additions, -215 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.3.24.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` (+5 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+38 -38) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/candidate-reconciliation.ts` (+58 -33) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts` (+81 -45) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-processing.ts` (+113 -59) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-extraction-reliability.regression.ts` (+612 -0) </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #1087 ## Why this change - Importing several sources in one batch, or running two imports at the same time, could create a duplicate memory. Candidate reconciliation matched against the recall snapshot captured before the provider call, so a compatible target committed after that snapshot (a sibling batch item or a concurrent import) was invisible and the second source created a new note under a different ID. - A stale batch projection could also revive an archived or resolved memory as a reconciliation target and mutate a note that is no longer an active recall target. ## What changed - `packages/long-term-memory` `1.3.23` → `1.3.24` (manifest, rebuilt `server.mjs`, `artifacts/long-term-memory-1.3.24.zip`, catalog lanes and `notes.json` release note). - `candidate-reconciliation.ts`: a commit-time caller may supply the complete fresh candidate set; matching against a complete set is authoritative, so a singleton match is safe to reuse. Candidate notes exclude `archived` and `resolved` memories so a terminal note is never a target. - `source-extraction.ts`: extraction now returns a `recompile` that re-runs the vault-derived stages against a caller-supplied candidate set without repeating the provider call. - `source-processing.ts`: commit recompiles against the fresh vault plus the batch overlay. The by-id merge keeps one candidate per note, and the overlay yields to a durable `archived`/`resolved` status so a stale active projection cannot revive a terminal note. A failed fresh scan falls back to the preparation snapshot. - `scripts/build-feature-packages.mjs`: version bump to `1.3.24`. - `tests/long-term-memory-extraction-reliability.regression.ts`: regressions for same-batch reuse, reuse of a note committed during the provider call, the archived-target case, the duplicate durable/overlay case, and the terminal-overlay case. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none — `engine.min` (`2.4.1`) and `engine.maxExclusive` (`4.0.0`) unchanged. - New or changed permissions/entrypoints: none — permissions (`agent-runtime`, `chat-read`, `chat-write`, `routes`, `storage`, `ui`) and entrypoints unchanged. - Restart, storage, update, or uninstall impact: none — no stored-data migration and no change to vault or draft formats; `restartRequired` unchanged. ## 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 Executed as agent evidence on the pushed revision `583312847882307706ff7d7449c14f53588e5196`; a human must re-verify before ticking any box above. - LTM tsx regressions all pass: `candidate-reconciliation`, `reconciliation-recall`, `extraction-graph`, `runtime`, `routes-imports`, `routes`, `storage`, `local-characters`, `extraction-reliability`, `installation` (exact `1.3.24` ZIP install, offline restart, backup inclusion, uninstall/reinstall, durable-byte preservation). - `tests/long-term-memory-loading.regression.mjs` passes. - `npm run check` (0 errors, 849 pre-existing warnings), `git diff --check`, `node scripts/typecheck-packages.mjs long-term-memory`, `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-catalog.mjs` (38 packages; v2=38, v3=38; legacy=v2) and `node scripts/tests/catalog-release-notes.regression.mjs` all pass. - The terminal-overlay regression was confirmed to fail on the pre-fix code (the second source targeted the archived note) and pass after the fix. - Not run locally: browser and lifecycle Playwright suites and hosted CI. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) Not applicable — no client or UI change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Concurrent and multi-source imports now reuse a compatible memory created or committed after extraction, avoiding duplicate memories. * Archived or resolved memories are no longer selected as reconciliation targets, even when a batch view shows outdated status. * Ambiguous or incomplete reconciliation now requires review rather than applying an uncertain match. * **Release** * Long-Term Memory updated to version 1.3.24. <!-- 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:07:45 +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#1290
No description provided.