[PR #1195] [MERGED] fix(long-term-memory): 1.3.38 — rebuild the recall index when a settings save changes it #1339

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

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/await-settings-index-rebuild


📝 Commits (2)

  • 1c54d63 fix(long-term-memory): 1.3.37 — rebuild the recall index when a settings save changes it
  • 818cb0d Merge remote-tracking branch 'upstream/staging' into fix(long-term-memory)/await-settings-index-rebuild

📊 Changes

20 files changed (+434 additions, -131 deletions)

View changed files

➕ artifacts/long-term-memory-1.3.38.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/client.js (+30 -30)
📝 packages/long-term-memory/manifest.json (+5 -5)
📝 packages/long-term-memory/server.mjs (+26 -26)
📝 packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/MemorySettings.tsx (+43 -12)
📝 packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/locales/en.json (+3 -0)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/rebuild.ts (+6 -2)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts (+18 -10)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts (+27 -3)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-feedback-clarity-ui.regression.mjs (+22 -0)
📝 tests/long-term-memory-routes.regression.ts (+138 -0)
📝 tests/long-term-memory-runtime.regression.ts (+69 -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 #1193

Why this change

Changing the global custom stop-word list, or the "filter generated" toggle, changes what the recall index contains, but PUT /settings and POST /settings/reset persisted the change without rebuilding. The next recall then paid for the whole stale rebuild inline, under the vault lock, and the Memory Settings UI reported only a generic "saved" message even when that later rebuild failed.

Separately, a recall that queued behind a settings save could read the pre-save stop words before the lock and then republish an index built with them after the lock, and extraction edits typed during the awaited global rebuild were overwritten when the save resolved.

What changed

  • PUT /settings and POST /settings/reset now await the existing rebuildAfterMutation result when — and only when — the effective generated stop-word set (normalized/sorted buildStopWordSet output plus the filter flag) actually changes. Recall-only settings still save without rebuilding.
  • The response keeps the saved settings shape and adds a rebuild complete/deferred outcome. A failed rebuild is reported as saved-but-index-failed; settings are not rolled back, re-reported as unsaved, or retried automatically. The index-state failed surface stays authoritative.
  • Memory Settings shows saved-and-rebuilt, saved-but-index-failed, and reset-but-index-failed messages, and only clears a form field whose submitted snapshot still matches, so newer edits stay dirty.
  • Effective stop words are now resolved inside the vault lock in rebuildLongTermMemoryIndexes and loadOrRebuildLongTermMemoryIndexes, and retrieveLongTermMemory reads settings and loads the index under one lock scope, so a recall queued behind a save cannot republish an index built with the old stop words.
  • Version bumped to 1.3.38 (upstream already shipped 1.3.37 with the plain-words description change); package payload, manifest, artifact, and all catalog lanes/notes rebuilt from source.
  • New regressions: a deterministic concurrent settings-save/recall interleaving in tests/long-term-memory-runtime.regression.ts, route coverage for the settings/reset rebuild outcomes, and a static UI assertion for extraction-edit preservation.

Package and security impact

  • Affected package IDs: long-term-memory (1.3.38).
  • Engine compatibility impact: none. engine.min = 2.4.1, engine.maxExclusive = 4.0.0, builtAgainst unchanged.
  • New or changed permissions/entrypoints: none. Permissions remain agent-runtime, chat-read, chat-write, routes, storage, ui; entrypoints unchanged.
  • Restart, storage, update, or uninstall impact: restartRequired unchanged (true). The settings save can now trigger a recall-index rebuild; the on-disk settings and index schemas are unchanged, and no user state is silently dropped.

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

Local checks run on final HEAD 818cb0da73b35b9d422ea6198271405fd91446a9 (merge of upstream/staging deae826baab5e79aba5545c0fd4265c60c59a999), worktree clean:

  • test-fast.sh (npm run check + both git diff --check checks) — pass.
  • npm run typecheck:packages — pass; Long-Term Memory had no syntax, undefined-name, or unresolved-module errors.
  • node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-package-locale-keys.mjs, node scripts/tests/ui-translation-retention.regression.mjs, node scripts/validate-catalog.mjs, node scripts/tests/catalog-generatedat-determinism.regression.mjs, node scripts/tests/catalog-release-notes.regression.mjs — pass.
  • test-ltm.sh runtime, routes, routes-backup, storage, feedback-clarity-ui, installation, loading — pass. The installation regression exercises install, offline restart, backup inclusion, uninstall, reinstall, and durable-byte preservation against the rebuilt 1.3.38 archive.
  • Red baseline: temporarily reverting the retrieval lock-wrap made the new runtime regression fail with mismatched final index hashes; the repair restored it.
  • Artifact, manifest, embedded package manifest, all three catalog lanes and the legacy alias agree on artifacts/long-term-memory-1.3.38.zip (sha256 cb2cdc3a... computed at build; regenerated in this commit).

Not performed: hosted CI, CodeRabbit, and a browser-interactive save-flow check. The client edit-preservation fix is covered by a static source assertion because the repository has no DOM/interaction harness for MemorySettings.

Documentation impact

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

No README or Engine documentation change is needed: the package was already listed and only its version and behavior changed.

UI evidence (if applicable)

No screenshots. The UI change is state handling for existing messages plus three new localized strings; no layout change.

Summary by CodeRabbit

  • New Features
    • Changing stop-word settings or enabling generated-text filtering now rebuilds the recall index when needed. Settings are saved even if rebuilding fails, and the settings screen reports the outcome.
  • Bug Fixes
    • Prevented queued recalls from publishing an index based on outdated settings.
    • Preserved extraction edits made while an index rebuild is in progress.
  • Release
    • Updated Long-Term Memory to version 1.3.38.

🔄 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/1195 **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)/await-settings-index-rebuild` --- ### 📝 Commits (2) - [`1c54d63`](https://github.com/Pasta-Devs/Marinara-Agents/commit/1c54d63e343c63bb8a026d97729b51fafef6bcbf) fix(long-term-memory): 1.3.37 — rebuild the recall index when a settings save changes it - [`818cb0d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/818cb0da73b35b9d422ea6198271405fd91446a9) Merge remote-tracking branch 'upstream/staging' into fix(long-term-memory)/await-settings-index-rebuild ### 📊 Changes **20 files changed** (+434 additions, -131 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.3.38.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/client.js` (+30 -30) 📝 `packages/long-term-memory/manifest.json` (+5 -5) 📝 `packages/long-term-memory/server.mjs` (+26 -26) 📝 `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/MemorySettings.tsx` (+43 -12) 📝 `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/locales/en.json` (+3 -0) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/rebuild.ts` (+6 -2) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts` (+18 -10) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts` (+27 -3) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-feedback-clarity-ui.regression.mjs` (+22 -0) 📝 `tests/long-term-memory-routes.regression.ts` (+138 -0) 📝 `tests/long-term-memory-runtime.regression.ts` (+69 -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 #1193 ## Why this change Changing the global custom stop-word list, or the "filter generated" toggle, changes what the recall index contains, but `PUT /settings` and `POST /settings/reset` persisted the change without rebuilding. The next recall then paid for the whole stale rebuild inline, under the vault lock, and the Memory Settings UI reported only a generic "saved" message even when that later rebuild failed. Separately, a recall that queued behind a settings save could read the pre-save stop words before the lock and then republish an index built with them after the lock, and extraction edits typed during the awaited global rebuild were overwritten when the save resolved. ## What changed - `PUT /settings` and `POST /settings/reset` now await the existing `rebuildAfterMutation` result when — and only when — the effective generated stop-word set (normalized/sorted `buildStopWordSet` output plus the filter flag) actually changes. Recall-only settings still save without rebuilding. - The response keeps the saved settings shape and adds a `rebuild` `complete`/`deferred` outcome. A failed rebuild is reported as saved-but-index-failed; settings are not rolled back, re-reported as unsaved, or retried automatically. The index-state `failed` surface stays authoritative. - Memory Settings shows saved-and-rebuilt, saved-but-index-failed, and reset-but-index-failed messages, and only clears a form field whose submitted snapshot still matches, so newer edits stay dirty. - Effective stop words are now resolved inside the vault lock in `rebuildLongTermMemoryIndexes` and `loadOrRebuildLongTermMemoryIndexes`, and `retrieveLongTermMemory` reads settings and loads the index under one lock scope, so a recall queued behind a save cannot republish an index built with the old stop words. - Version bumped to `1.3.38` (upstream already shipped `1.3.37` with the plain-words description change); package payload, manifest, artifact, and all catalog lanes/notes rebuilt from source. - New regressions: a deterministic concurrent settings-save/recall interleaving in `tests/long-term-memory-runtime.regression.ts`, route coverage for the settings/reset rebuild outcomes, and a static UI assertion for extraction-edit preservation. ## Package and security impact - Affected package IDs: `long-term-memory` (1.3.38). - Engine compatibility impact: none. `engine.min = 2.4.1`, `engine.maxExclusive = 4.0.0`, `builtAgainst` unchanged. - New or changed permissions/entrypoints: none. Permissions remain `agent-runtime`, `chat-read`, `chat-write`, `routes`, `storage`, `ui`; entrypoints unchanged. - Restart, storage, update, or uninstall impact: `restartRequired` unchanged (`true`). The settings save can now trigger a recall-index rebuild; the on-disk settings and index schemas are unchanged, and no user state is silently dropped. ## 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 Local checks run on final HEAD `818cb0da73b35b9d422ea6198271405fd91446a9` (merge of `upstream/staging` `deae826baab5e79aba5545c0fd4265c60c59a999`), worktree clean: - `test-fast.sh` (npm run check + both `git diff --check` checks) — pass. - `npm run typecheck:packages` — pass; Long-Term Memory had no syntax, undefined-name, or unresolved-module errors. - `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-package-locale-keys.mjs`, `node scripts/tests/ui-translation-retention.regression.mjs`, `node scripts/validate-catalog.mjs`, `node scripts/tests/catalog-generatedat-determinism.regression.mjs`, `node scripts/tests/catalog-release-notes.regression.mjs` — pass. - `test-ltm.sh runtime`, `routes`, `routes-backup`, `storage`, `feedback-clarity-ui`, `installation`, `loading` — pass. The `installation` regression exercises install, offline restart, backup inclusion, uninstall, reinstall, and durable-byte preservation against the rebuilt `1.3.38` archive. - Red baseline: temporarily reverting the retrieval lock-wrap made the new runtime regression fail with mismatched final index hashes; the repair restored it. - Artifact, manifest, embedded package manifest, all three catalog lanes and the legacy alias agree on `artifacts/long-term-memory-1.3.38.zip` (sha256 `cb2cdc3a...` computed at build; regenerated in this commit). Not performed: hosted CI, CodeRabbit, and a browser-interactive save-flow check. The client edit-preservation fix is covered by a static source assertion because the repository has no DOM/interaction harness for `MemorySettings`. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation No README or Engine documentation change is needed: the package was already listed and only its version and behavior changed. ## UI evidence (if applicable) No screenshots. The UI change is state handling for existing messages plus three new localized strings; no layout change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Changing stop-word settings or enabling generated-text filtering now rebuilds the recall index when needed. Settings are saved even if rebuilding fails, and the settings screen reports the outcome. * **Bug Fixes** * Prevented queued recalls from publishing an index based on outdated settings. * Preserved extraction edits made while an index rebuild is in progress. * **Release** * Updated Long-Term Memory to version 1.3.38. <!-- 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:12 +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#1339
No description provided.