[PR #920] [MERGED] fix(long-term-memory): serialize source context finalization #1191

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

📋 Pull Request Information

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

Base: staging ← Head: fix/long-term-memory-context-dedup-freshness


📝 Commits (3)

  • 5245082 fix(long-term-memory): serialize source context finalization (#913)
  • 5d56096 Merge branch 'staging' into fix/long-term-memory-context-dedup-freshness
  • a566a30 fix(long-term-memory): preserve extraction context fixes

📊 Changes

14 files changed (+383 additions, -128 deletions)

View changed files

➕ artifacts/long-term-memory-1.3.4.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -0)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -0)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -0)
📝 packages/long-term-memory/CHANGELOG.md (+7 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+36 -36)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts (+16 -14)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-processing.ts (+80 -56)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-extraction-reliability.regression.ts (+204 -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 #913

Why this change

  • Long-Term Memory source context was being prepared before extraction finalization, and deferred writes could overwrite a concurrent destination or mode change.
  • Clean duplicate-only extraction batches were not consistently treated as current.

What changed

  • Affected package: long-term-memory.
  • Keep source destination/modes binding in memory until successful finalization.
  • Serialize finalization, draft/overlay publication, and source context persistence with the existing per-vault reentrant lock.
  • Persist destination scope, modes, and extraction fingerprint together.
  • Preserve source-material-before-context conflict ordering.
  • Add regression coverage for clean dedup freshness, failed preparation, and concurrent writers; rerun existing Game/batch coverage in the affected suites.
  • Rebuilt server.mjs, the 1.3.4 ZIP artifact, and all catalog lane/notes records.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: unchanged; Engine >=2.4.1 <4.0.0, capability API 1.6.
  • New or changed permissions/entrypoints: none.
  • Restart, storage, update, or uninstall impact: runtime package rebuilt; no storage schema or uninstall behavior change.

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

  • npm run check: passed with 0 errors; repository reports 197 pre-existing warnings.
  • node scripts/typecheck-packages.mjs long-term-memory: passed (no undefined names).
  • Passed all five affected Engine suites from /home/damo/dev/Marinara-Engine: extraction reliability, storage, extraction graph, conversation-summary import, and routes imports.
  • Passed catalog lanes, package locales, catalog, release-notes, and git diff --check validation.
  • Rebuilt with MARINARA_ENGINE_ROOT=/home/damo/dev/Marinara-Engine node scripts/build-feature-packages.mjs long-term-memory.
  • Final artifact: artifacts/long-term-memory-1.3.4.zip, 1,317,874 bytes, SHA-256 609cc63ab1560a81511317ff49f8aab3ee933b6fd3a30625c43641b1f50f5d38; catalog records match.
  • Intentional no-lock regression failed at the expected late overwrite assertion; the restored locked implementation passed the same regression.
  • No hosted CI result or manual install/update/restart/uninstall verification was performed locally.
  • Validation is focused, not full-suite proof: the complete LTM suite and all repository CI commands have not been run locally. The pre-push proof assertion checked supplied HEAD values but did not bind validation to a captured workspace/Engine snapshot; it is not sufficient publication-proof evidence. Keep this PR draft pending those gates.

Documentation impact

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

UI evidence (if applicable)

Not applicable; this is Long-Term Memory server/persistence behavior.

Summary by CodeRabbit

  • Bug Fixes

    • Failed or cancelled source-note extractions no longer modify the original note.
    • Concurrent source-context changes are detected and rejected before updates are committed.
    • Duplicate-only extraction results are recognized as current, preventing unnecessary reprocessing.
    • Error-diagnostic extractions are no longer marked as current.
    • Source-note updates and extraction finalization are handled atomically to prevent conflicting writes.
  • Release

    • Updated the long-term-memory package to version 1.3.4.

🔄 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/920 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 9/18/2026 **Status:** ✅ Merged **Merged:** 9/19/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix/long-term-memory-context-dedup-freshness` --- ### 📝 Commits (3) - [`5245082`](https://github.com/Pasta-Devs/Marinara-Agents/commit/524508202ed99899487251e75c94ddfa60170efd) fix(long-term-memory): serialize source context finalization (#913) - [`5d56096`](https://github.com/Pasta-Devs/Marinara-Agents/commit/5d56096c1659f3838495519b0565cb9228489088) Merge branch 'staging' into fix/long-term-memory-context-dedup-freshness - [`a566a30`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a566a3076b0c8ab389c69cd4ff1276982d956697) fix(long-term-memory): preserve extraction context fixes ### 📊 Changes **14 files changed** (+383 additions, -128 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.3.4.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -0) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -0) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -0) 📝 `packages/long-term-memory/CHANGELOG.md` (+7 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+36 -36) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts` (+16 -14) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-processing.ts` (+80 -56) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-extraction-reliability.regression.ts` (+204 -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 #913 ## Why this change - Long-Term Memory source context was being prepared before extraction finalization, and deferred writes could overwrite a concurrent destination or mode change. - Clean duplicate-only extraction batches were not consistently treated as current. ## What changed - Affected package: `long-term-memory`. - Keep source destination/modes binding in memory until successful finalization. - Serialize finalization, draft/overlay publication, and source context persistence with the existing per-vault reentrant lock. - Persist destination scope, modes, and extraction fingerprint together. - Preserve source-material-before-context conflict ordering. - Add regression coverage for clean dedup freshness, failed preparation, and concurrent writers; rerun existing Game/batch coverage in the affected suites. - Rebuilt `server.mjs`, the `1.3.4` ZIP artifact, and all catalog lane/notes records. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: unchanged; Engine `>=2.4.1 <4.0.0`, capability API `1.6`. - New or changed permissions/entrypoints: none. - Restart, storage, update, or uninstall impact: runtime package rebuilt; no storage schema or uninstall behavior change. ## 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 - `npm run check`: passed with 0 errors; repository reports 197 pre-existing warnings. - `node scripts/typecheck-packages.mjs long-term-memory`: passed (`no undefined names`). - Passed all five affected Engine suites from `/home/damo/dev/Marinara-Engine`: extraction reliability, storage, extraction graph, conversation-summary import, and routes imports. - Passed catalog lanes, package locales, catalog, release-notes, and `git diff --check` validation. - Rebuilt with `MARINARA_ENGINE_ROOT=/home/damo/dev/Marinara-Engine node scripts/build-feature-packages.mjs long-term-memory`. - Final artifact: `artifacts/long-term-memory-1.3.4.zip`, 1,317,874 bytes, SHA-256 `609cc63ab1560a81511317ff49f8aab3ee933b6fd3a30625c43641b1f50f5d38`; catalog records match. - Intentional no-lock regression failed at the expected late overwrite assertion; the restored locked implementation passed the same regression. - No hosted CI result or manual install/update/restart/uninstall verification was performed locally. - Validation is focused, not full-suite proof: the complete LTM suite and all repository CI commands have not been run locally. The pre-push proof assertion checked supplied HEAD values but did not bind validation to a captured workspace/Engine snapshot; it is not sufficient publication-proof evidence. Keep this PR draft pending those gates. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) Not applicable; this is Long-Term Memory server/persistence behavior. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Failed or cancelled source-note extractions no longer modify the original note. - Concurrent source-context changes are detected and rejected before updates are committed. - Duplicate-only extraction results are recognized as current, preventing unnecessary reprocessing. - Error-diagnostic extractions are no longer marked as current. - Source-note updates and extraction finalization are handled atomically to prevent conflicting writes. - **Release** - Updated the long-term-memory package to version 1.3.4. <!-- 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:05:02 +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#1191
No description provided.