[PR #1422] [MERGED] fix(long-term-memory): 1.4.39 — a settings field from a newer version no longer stops activation (#1415) #1453

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

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/1415-settings-unknown-fields


📝 Commits (3)

  • 6e1e6e3 fix(long-term-memory): settings fields from a newer version no longer stop activation (#1415)
  • e0d31d8 Merge upstream/staging into fix(long-term-memory)/1415-settings-unknown-fields; release long-term-memory 1.4.39
  • 5d3ba80 fix(long-term-memory): retention settings from a newer version no longer stop activation (#1415)

📊 Changes

18 files changed (+256 additions, -125 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.39.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 (+52 -50)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/backup-restore.ts (+6 -4)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction-config.ts (+14 -9)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retention.ts (+6 -3)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/runtime.ts (+5 -4)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts (+52 -5)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/storage.ts (+5 -3)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-storage.regression.ts (+72 -7)

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

Why this change

Long-Term Memory parsed its settings files strictly, so one field written by a newer version stopped an older version from activating. Every chat then had no recall and no extraction until someone edited the file by hand. This bites after a failed update: the Engine rolls back to the previous version, and that version can't read the settings the newer one already saved. Backup export and saving settings failed the same way.

What changed

  • Package long-term-memory 1.4.38 → 1.4.39 (patch). Rebuilt server.mjs, manifest.json, artifacts/long-term-memory-1.4.39.zip, the catalogs and catalog notes. client.js is unchanged.
  • Settings files are read leniently. Top-level fields that the strict schema reports as unrecognized are split off and logged by name once per file, without values. The rest is parsed as before. Saves write those fields back.
 activation self-check (runtime.ts)
   initializeLtmStore                 # storage.ts, rewrites settings.json
-    ltmGlobalSettingsSchema / ltmRetentionConfigSchema.parse(file)  → throws on a newer field
+    readLtmSettingsFile → write { ...unknown, ...settings }        # settings.json and retention.json
   getLtmGlobalSettings               # settings.ts
   getLtmExtractionConfig             # extraction-config.ts
   agent-settings.json read           # runtime.ts
 runLongTermMemoryRetention           # retention.ts: retention.json
 backup export readConfig             # backup-restore.ts: extraction, retention, agent
 updateLtmGlobalSettings / updateLtmExtractionConfig
-  write parsed
+  write { ...unknownFromFile, ...parsed }        # the request is still parsed strictly
  • Beyond the issue's Minimal fix (maintainer-approved): storage.ts initializeLtmStore is the first step of the activation check, and it also parsed and rewrote settings.json strictly. Without this change, activation still failed. A lenient read that dropped the field would also have stripped it on every startup.
  • Retention, added after CodeRabbit's review: retention.json is read the same way at startup and in the retention run (retention.ts). Every retention field has a default and startup rewrites the file, so a retention field added by a newer version reaches disk without any user action. It was the most likely way to hit this bug.
  • What counts as unknown: the keys the strict schema itself rejects. The schema preprocessors already delete removed legacy fields such as extractionMode, so those are still dropped silently, not logged or kept.
  • Unchanged:
    • Request bodies stay strict (PUT /settings, PUT /extraction-settings).
    • A known field with an invalid value still fails.
    • Reset writes defaults only.
    • Restoring a backup made by a newer version still fails.
    • Nested unknown keys still fail.
  • Merged upstream/staging (fab3bcf3f, #1421) for the release.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none (range unchanged, >=2.4.1 <4.0.0)
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact:
    • Settings files may now hold fields this version doesn't know, and startup and saves keep them.
    • This only helps from the release after this one; older versions are unaffected.
    • Trade-off: a misspelled key in a hand-edited settings file is now ignored with a warning instead of failing activation.
  • Merge danger:
    • Two-way door. Reverting restores strict reads.
    • Files saved in the meantime contain only fields 1.4.38 knows, unless a newer version had already added one.
  • Known gap: a new enum value or a new nested field (for example inside a prompt template) still fails, as before.

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

Run locally by the author. This is informational; the boxes above are left for a human.

  • Before: test-ltm.sh storage on the unfixed source exits 1, with ZodError unrecognized_keys at activateLongTermMemoryStorage.
  • After: the same test exits 0.
  • What the regression checks (tests/long-term-memory-storage.regression.ts, replacing "self-check must reject malformed settings"):
write newer field to settings.json, extraction.json, agent-settings.json, retention.json
activate                      → succeeds; one warning per file names the field, no value, no legacy key
settings.json after startup   → { version: 1, someNewSetting }   (legacy extractionMode dropped)
retention.json after startup  → keeps someNewRetentionSetting; the later forced retention run reads it
resolved settings             → no someNew* key
strict schema / update request with the field  → rejected
backup export                 → succeeds, no someNew* key
updateLtmExtractionConfig / updateLtmGlobalSettings → file keeps the field
newer field + invalid known value → still throws
  • Retention addition: with only the test extended, test-ltm.sh storage exits 1 (unrecognized_keys at activation); with the fix it exits 0.
  • Pushed HEAD 5d3ba80de, against Engine 2039583ca:
    • test-ltm.sh storage, runtime, routes, routes-backup and installation (1.4.39) all exit 0.
    • npm run check, typecheck-packages long-term-memory, test-catalog-lanes, validate-package-locales, validate-catalog, the catalog-release-notes regression and git diff --check all exit 0.
    • A second rebuild left no diff.
  • Type check: a private tsc --noEmit run on the six changed server files shows the same 14 errors as staging and no new ones.
  • Review: one read-only review pass found no Blocking, High or Medium issues.
  • Not done: install through a running Engine UI, and a manual rollback scenario.

Documentation impact

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

UI evidence (if applicable)

Not applicable.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Compatibility
    • Long-Term Memory 1.4.39 can load settings files containing fields from newer versions across memory, extraction, agent, and retention settings. These fields are preserved when settings are saved, with a warning recorded in the server log.
    • App-submitted settings remain strictly validated, invalid known values are rejected, and fields no longer supported by the current version are removed.
  • Bug Fixes
    • Backups and settings updates handle fields from newer versions without exposing unsupported fields in exported settings.

🔄 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/1422 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/1415-settings-unknown-fields` --- ### 📝 Commits (3) - [`6e1e6e3`](https://github.com/Pasta-Devs/Marinara-Agents/commit/6e1e6e3bd1fdc295e2525dc24b113ef7b5eb18e8) fix(long-term-memory): settings fields from a newer version no longer stop activation (#1415) - [`e0d31d8`](https://github.com/Pasta-Devs/Marinara-Agents/commit/e0d31d850226de4511e2e126170802c5d5f5103a) Merge upstream/staging into fix(long-term-memory)/1415-settings-unknown-fields; release long-term-memory 1.4.39 - [`5d3ba80`](https://github.com/Pasta-Devs/Marinara-Agents/commit/5d3ba80de3d20f4fec3c811e9fee41767cb1d06d) fix(long-term-memory): retention settings from a newer version no longer stop activation (#1415) ### 📊 Changes **18 files changed** (+256 additions, -125 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.39.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` (+52 -50) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/backup-restore.ts` (+6 -4) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction-config.ts` (+14 -9) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retention.ts` (+6 -3) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/runtime.ts` (+5 -4) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts` (+52 -5) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/storage.ts` (+5 -3) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-storage.regression.ts` (+72 -7) </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 #1415 ## Why this change Long-Term Memory parsed its settings files strictly, so one field written by a newer version stopped an older version from activating. Every chat then had no recall and no extraction until someone edited the file by hand. This bites after a failed update: the Engine rolls back to the previous version, and that version can't read the settings the newer one already saved. Backup export and saving settings failed the same way. ## What changed - Package `long-term-memory` 1.4.38 → 1.4.39 (patch). Rebuilt `server.mjs`, `manifest.json`, `artifacts/long-term-memory-1.4.39.zip`, the catalogs and catalog notes. `client.js` is unchanged. - Settings files are read leniently. Top-level fields that the strict schema reports as unrecognized are split off and logged by name once per file, without values. The rest is parsed as before. Saves write those fields back. ```diff activation self-check (runtime.ts) initializeLtmStore # storage.ts, rewrites settings.json - ltmGlobalSettingsSchema / ltmRetentionConfigSchema.parse(file) → throws on a newer field + readLtmSettingsFile → write { ...unknown, ...settings } # settings.json and retention.json getLtmGlobalSettings # settings.ts getLtmExtractionConfig # extraction-config.ts agent-settings.json read # runtime.ts runLongTermMemoryRetention # retention.ts: retention.json backup export readConfig # backup-restore.ts: extraction, retention, agent updateLtmGlobalSettings / updateLtmExtractionConfig - write parsed + write { ...unknownFromFile, ...parsed } # the request is still parsed strictly ``` - **Beyond the issue's Minimal fix (maintainer-approved):** `storage.ts` `initializeLtmStore` is the first step of the activation check, and it also parsed and rewrote `settings.json` strictly. Without this change, activation still failed. A lenient read that dropped the field would also have stripped it on every startup. - **Retention, added after CodeRabbit's review:** `retention.json` is read the same way at startup and in the retention run (`retention.ts`). Every retention field has a default and startup rewrites the file, so a retention field added by a newer version reaches disk without any user action. It was the most likely way to hit this bug. - **What counts as unknown:** the keys the strict schema itself rejects. The schema preprocessors already delete removed legacy fields such as `extractionMode`, so those are still dropped silently, not logged or kept. - **Unchanged:** - Request bodies stay strict (`PUT /settings`, `PUT /extraction-settings`). - A known field with an invalid value still fails. - Reset writes defaults only. - Restoring a backup made by a newer version still fails. - Nested unknown keys still fail. - Merged `upstream/staging` (`fab3bcf3f`, #1421) for the release. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none (range unchanged, `>=2.4.1 <4.0.0`) - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: - Settings files may now hold fields this version doesn't know, and startup and saves keep them. - This only helps from the release after this one; older versions are unaffected. - Trade-off: a misspelled key in a hand-edited settings file is now ignored with a warning instead of failing activation. - Merge danger: - Two-way door. Reverting restores strict reads. - Files saved in the meantime contain only fields 1.4.38 knows, unless a newer version had already added one. - Known gap: a new enum value or a new nested field (for example inside a prompt template) still fails, as before. ## 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 Run locally by the author. This is informational; the boxes above are left for a human. - **Before:** `test-ltm.sh storage` on the unfixed source exits 1, with `ZodError unrecognized_keys` at `activateLongTermMemoryStorage`. - **After:** the same test exits 0. - **What the regression checks** (`tests/long-term-memory-storage.regression.ts`, replacing "self-check must reject malformed settings"): ```text write newer field to settings.json, extraction.json, agent-settings.json, retention.json activate → succeeds; one warning per file names the field, no value, no legacy key settings.json after startup → { version: 1, someNewSetting } (legacy extractionMode dropped) retention.json after startup → keeps someNewRetentionSetting; the later forced retention run reads it resolved settings → no someNew* key strict schema / update request with the field → rejected backup export → succeeds, no someNew* key updateLtmExtractionConfig / updateLtmGlobalSettings → file keeps the field newer field + invalid known value → still throws ``` - **Retention addition:** with only the test extended, `test-ltm.sh storage` exits 1 (`unrecognized_keys` at activation); with the fix it exits 0. - **Pushed HEAD `5d3ba80de`, against Engine `2039583ca`:** - `test-ltm.sh` storage, runtime, routes, routes-backup and installation (1.4.39) all exit 0. - `npm run check`, `typecheck-packages long-term-memory`, `test-catalog-lanes`, `validate-package-locales`, `validate-catalog`, the `catalog-release-notes` regression and `git diff --check` all exit 0. - A second rebuild left no diff. - **Type check:** a private `tsc --noEmit` run on the six changed server files shows the same 14 errors as `staging` and no new ones. - **Review:** one read-only review pass found no Blocking, High or Medium issues. - **Not done:** install through a running Engine UI, and a manual rollback scenario. ## Documentation impact - [x] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) Not applicable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Compatibility** * Long-Term Memory 1.4.39 can load settings files containing fields from newer versions across memory, extraction, agent, and retention settings. These fields are preserved when settings are saved, with a warning recorded in the server log. * App-submitted settings remain strictly validated, invalid known values are rejected, and fields no longer supported by the current version are removed. * **Bug Fixes** * Backups and settings updates handle fields from newer versions without exposing unsupported fields in exported settings. <!-- 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:40 +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#1453
No description provided.