[GH-ISSUE #1246] [Issue]: Invalid LTM settings values poison recall #634

Closed
opened 2026-10-20 17:29:14 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1246

Originally assigned to: @Promansis on GitHub.

Summary

Persisting a null LTM recall weight or an unknown stored recall style makes the resolved settings invalid. Every subsequent recall and settings read throws instead of falling back to safe defaults.

Affected package

long-term-memory (LTM), package version 1.4.7

Expected behavior

Invalid persisted values should be ignored and replaced with the corresponding defaults:

  • A null or undefined weight should retain its numeric default.
  • An unknown stored recall style should fall back to balanced.
  • Recall, GET /settings, and the in-product reset/update paths should continue to work so the invalid settings can be repaired.

Actual behavior

The partial settings schema accepts null weights. The settings loader then spreads the parsed value over the defaults, so a null weight reaches the strict resolved schema and throws. For an unknown style, preprocessing assigns undefined to a present key; the spread removes the balanced default and the strict enum parse throws Required.

Once either value is persisted, all settings reads throw. This breaks generation recall, retrieval, extraction, /search, and GET /settings. The normal PUT and reset paths also read the current settings first, so the installation cannot be repaired in-product.

Steps to reproduce

  1. Persist a null weight, for example with PUT /settings and { "longTermMemorySemanticWeight": null }, or restore a backup containing a null weight.
  2. Alternatively, persist a recall style name that this build does not recognize.
  3. Trigger a settings read, recall, /search, or the settings reset/update flow.

The audit probe against the real source modules produced:

baseline              -> OK style=balanced semantic=0.6
null semantic weight  -> THROWS longTermMemorySemanticWeight: Expected number, received null
unknown recall style  -> THROWS longTermMemoryRecallStyle: Required
partial accepts null: true

Environment

  • Marinara Engine version: Not pinned in the audit; local Engine checkout was used for dependencies only
  • Package version: 1.4.7
  • Install type: source checkout / runtime probe
  • OS + version: Linux (version not recorded)
  • Browser or app shell: Not applicable; server settings and recall path

Logs, screenshots, or video

See the reproduction output above. No private chat data or credentials are included.

Additional context

Relevant paths from the audit:

  • packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/schema.ts
  • packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts
  • packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts
  • packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/backup-restore.ts

A likely fix is to remove null/undefined entries before merging parsed partial settings into defaults, or to delete invalid keys during preprocessing. Add regression coverage for both a null weight and an unknown style, including recovery through the normal settings paths.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1246 Originally assigned to: @Promansis on GitHub. ## Summary Persisting a null LTM recall weight or an unknown stored recall style makes the resolved settings invalid. Every subsequent recall and settings read throws instead of falling back to safe defaults. ## Affected package `long-term-memory` (LTM), package version `1.4.7` ## Expected behavior Invalid persisted values should be ignored and replaced with the corresponding defaults: - A null or undefined weight should retain its numeric default. - An unknown stored recall style should fall back to `balanced`. - Recall, `GET /settings`, and the in-product reset/update paths should continue to work so the invalid settings can be repaired. ## Actual behavior The partial settings schema accepts null weights. The settings loader then spreads the parsed value over the defaults, so a null weight reaches the strict resolved schema and throws. For an unknown style, preprocessing assigns `undefined` to a present key; the spread removes the `balanced` default and the strict enum parse throws `Required`. Once either value is persisted, all settings reads throw. This breaks generation recall, retrieval, extraction, `/search`, and `GET /settings`. The normal PUT and reset paths also read the current settings first, so the installation cannot be repaired in-product. ## Steps to reproduce 1. Persist a null weight, for example with `PUT /settings` and `{ "longTermMemorySemanticWeight": null }`, or restore a backup containing a null weight. 2. Alternatively, persist a recall style name that this build does not recognize. 3. Trigger a settings read, recall, `/search`, or the settings reset/update flow. The audit probe against the real source modules produced: ```text baseline -> OK style=balanced semantic=0.6 null semantic weight -> THROWS longTermMemorySemanticWeight: Expected number, received null unknown recall style -> THROWS longTermMemoryRecallStyle: Required partial accepts null: true ``` ## Environment - Marinara Engine version: Not pinned in the audit; local Engine checkout was used for dependencies only - Package version: `1.4.7` - Install type: source checkout / runtime probe - OS + version: Linux (version not recorded) - Browser or app shell: Not applicable; server settings and recall path ## Logs, screenshots, or video See the reproduction output above. No private chat data or credentials are included. ## Additional context Relevant paths from the audit: - `packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/schema.ts` - `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts` - `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts` - `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/backup-restore.ts` A likely fix is to remove null/undefined entries before merging parsed partial settings into defaults, or to delete invalid keys during preprocessing. Add regression coverage for both a null weight and an unknown style, including recovery through the normal settings paths. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:29:14 +07:00
  • closed this issue
  • added the
    bug
    label
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#634
No description provided.