[PR #1191] [MERGED] fix(long-term-memory): recheck recall freshness under vault lock and honor cancellation #1334

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

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/1178-rebuild-freshness-cancellation


📝 Commits (2)

  • 43f7a8d fix(long-term-memory): recheck recall freshness under vault lock and honor cancellation
  • 53a2d80 Merge remote-tracking branch 'upstream/staging' into fix(long-term-memory)/1178-rebuild-freshness-cancellation

📊 Changes

17 files changed (+317 additions, -97 deletions)

View changed files

➕ artifacts/long-term-memory-1.3.35.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 (+34 -34)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/embedding-adapter.ts (+4 -0)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/generation-injection.ts (+1 -0)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/rebuild.ts (+36 -18)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts (+9 -1)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts (+4 -1)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-runtime.regression.ts (+185 -3)

📄 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 #1178

Why this change

  • Two concurrent stale Long-Term Memory recalls could each rebuild the recall index because freshness was checked before the vault lock, so both saw the same stale index and both rebuilt.
  • A timed-out or cancelled recall kept embedding work alive, held the vault lock, and could still publish a cancelled recall index and its pending dispatch receipt.

What changed

  • packages/long-term-memory 1.3.35:
    • Serialize the read/freshness/quarantine/rebuild lifecycle under the existing reentrant vault lock so a queued caller rechecks the index the previous caller just published.
    • Forward the recall AbortSignal into the loader, semantic-upgrade embedding, caller-supplied index recall, and the pending dispatch receipt. Cancellation no longer quarantines a valid index, disables the retry guard, ranks an abandoned index, or writes a cancelled receipt.
  • Rebuilt generated outputs from source: packages/long-term-memory/server.mjs, manifest.json, catalog/catalog.json, catalog/v2|c3/catalog.json, catalog/*/notes.json, and artifacts/long-term-memory-1.3.35.zip.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none; engine.min stays 2.4.1 and the compatibility range is unchanged.
  • New or changed permissions/entrypoints: none; manifest entrypoints and permissions are unchanged.
  • Restart, storage, update, or uninstall impact: none. The recall index and artifact format are unchanged; the exact-artifact installation regression covers install, offline restart, backup inclusion, uninstall, reinstall, and durable-byte preservation.

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

  • Added a focused LTM runtime regression for #1178: it failed before the fix (Missing expected rejection (AbortError) for a cancelled recall with a preloaded index) and passes after. The same suite also covers single-rebuild concurrency, cancellation signal delivery, non-publication after abort, vault-lock release for waiters, and batch stop.
  • Ran against Engine 227e3e12c87a55c40074413f1f32e57d732217da: runtime, extraction-graph, extraction-reliability, routes, source-task, candidate-reconciliation, reconciliation-recall, and the exact-artifact installation regression.
  • Ran npm run 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, node scripts/tests/catalog-release-notes.regression.mjs, and git diff --check.
  • Hosted CI and CodeRabbit have not run for this SHA yet.

Documentation impact

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

UI evidence (if applicable)

  • None: server-only change; client.js is unchanged.

Summary by CodeRabbit

  • Improvements
    • Updated Long-Term Memory to version 1.3.35. Recall now checks whether its index is current and rebuilds it safely when needed, avoiding duplicate rebuilds during concurrent requests.
    • Cancellation now stops recall, index rebuilding, and embedding work sooner, including when a preloaded index is used. Cancelled operations no longer publish a recall receipt.

🔄 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/1191 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/2/2026 **Status:** ✅ Merged **Merged:** 10/2/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/1178-rebuild-freshness-cancellation` --- ### 📝 Commits (2) - [`43f7a8d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/43f7a8d974865f91ad2870c2c6aa2e39e79f5b2b) fix(long-term-memory): recheck recall freshness under vault lock and honor cancellation - [`53a2d80`](https://github.com/Pasta-Devs/Marinara-Agents/commit/53a2d8083acec5d35f72b31a65a1b93b12dbfc50) Merge remote-tracking branch 'upstream/staging' into fix(long-term-memory)/1178-rebuild-freshness-cancellation ### 📊 Changes **17 files changed** (+317 additions, -97 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.3.35.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` (+34 -34) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/embedding-adapter.ts` (+4 -0) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/generation-injection.ts` (+1 -0) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/rebuild.ts` (+36 -18) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts` (+9 -1) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/source-extraction.ts` (+4 -1) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-runtime.regression.ts` (+185 -3) </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 #1178 ## Why this change - Two concurrent stale Long-Term Memory recalls could each rebuild the recall index because freshness was checked before the vault lock, so both saw the same stale index and both rebuilt. - A timed-out or cancelled recall kept embedding work alive, held the vault lock, and could still publish a cancelled recall index and its pending dispatch receipt. ## What changed - `packages/long-term-memory` 1.3.35: - Serialize the read/freshness/quarantine/rebuild lifecycle under the existing reentrant vault lock so a queued caller rechecks the index the previous caller just published. - Forward the recall `AbortSignal` into the loader, semantic-upgrade embedding, caller-supplied index recall, and the pending dispatch receipt. Cancellation no longer quarantines a valid index, disables the retry guard, ranks an abandoned index, or writes a cancelled receipt. - Rebuilt generated outputs from source: `packages/long-term-memory/server.mjs`, `manifest.json`, `catalog/catalog.json`, `catalog/v2|c3/catalog.json`, `catalog/*/notes.json`, and `artifacts/long-term-memory-1.3.35.zip`. ## Package and security impact - Affected package IDs: long-term-memory - Engine compatibility impact: none; `engine.min` stays `2.4.1` and the compatibility range is unchanged. - New or changed permissions/entrypoints: none; manifest entrypoints and permissions are unchanged. - Restart, storage, update, or uninstall impact: none. The recall index and artifact format are unchanged; the exact-artifact installation regression covers install, offline restart, backup inclusion, uninstall, reinstall, and durable-byte preservation. ## 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 - Added a focused LTM runtime regression for #1178: it failed before the fix (`Missing expected rejection (AbortError)` for a cancelled recall with a preloaded index) and passes after. The same suite also covers single-rebuild concurrency, cancellation signal delivery, non-publication after abort, vault-lock release for waiters, and batch stop. - Ran against Engine `227e3e12c87a55c40074413f1f32e57d732217da`: `runtime`, `extraction-graph`, `extraction-reliability`, `routes`, `source-task`, `candidate-reconciliation`, `reconciliation-recall`, and the exact-artifact `installation` regression. - Ran `npm run 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`, `node scripts/tests/catalog-release-notes.regression.mjs`, and `git diff --check`. - Hosted CI and CodeRabbit have not run for this SHA yet. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) - None: server-only change; `client.js` is unchanged. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Updated Long-Term Memory to version 1.3.35. Recall now checks whether its index is current and rebuilds it safely when needed, avoiding duplicate rebuilds during concurrent requests. * Cancellation now stops recall, index rebuilding, and embedding work sooner, including when a preloaded index is used. Cancelled operations no longer publish a recall receipt. <!-- 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:09:07 +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#1334
No description provided.