[GH-ISSUE #1418] [Issue]: Long-Term Memory: the Engine chat fields it reads are undocumented and unchecked #722

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

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

Originally assigned to: @Promansis on GitHub.

Summary

Long-Term Memory imports chat summaries by reading Engine-owned chat metadata fields directly. It also hard-codes the id of the Engine's built-in assistant character. engine-boundary.json declares no private Engine imports, so the boundary checker can't see either dependency, and nothing documents or tests them.

If the Engine renames or reshapes one of these fields, Sources quietly stops finding those summaries, with no error. If the assistant's id changes, the assistant and its chats start appearing as importable sources and places.

Affected package

long-term-memory 1.4.38 (upstream/staging 97c0486f8), packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/interop.ts:

Field LTM reads Read at Feeds Engine definition (2039583ca)
daySummaries, weekSummaries :190-191 day and week conversation summaries packages/shared/src/types/chat.ts:764, :766
summaryEntries :196 agent summary entries chat.ts:298
summary :218 the single legacy summary chat.ts:288
gamePreviousSessionSummaries :231 game session summaries chat.ts:616
"__professor_mari__" :74, used at :483, :514 and routes.ts:755-757 excludes the built-in assistant from sources and places packages/shared/src/constants/defaults.ts:21 (PROFESSOR_MARI_ID)

All five summary fields are members of the Engine's ChatMetadata interface. docs/ARCHITECTURE.md ("Boundaries") mentions none of these.

Expected behavior

  • The Engine fields LTM depends on are listed in the package docs.
  • A test fails when the Engine stops declaring one of them.

Actual behavior

The dependency is invisible:

  • the boundary file lists no private imports;
  • the architecture doc doesn't mention these fields;
  • no test checks them.

Steps to reproduce

  1. Search interop.ts for metadata. reads; the fields above appear.
  2. Check engine-boundary.json ("privateEngineImports": []) and docs/ARCHITECTURE.md: neither mentions them.

Environment

  • Marinara Engine version: 2.5.0 line (local Engine checkout at 2039583ca)
  • Package version: long-term-memory 1.4.38 (upstream/staging 97c0486f8)
  • Install type: source (code audit)
  • OS + version: not platform-specific
  • Browser or app shell: any

Logs, screenshots, or video

Not applicable.

Minimal fix

  1. Document. In docs/ARCHITECTURE.md → Boundaries, add the table above: which fields, what each feeds, and where the Engine defines them.
  2. Check. Add tests/long-term-memory-engine-fields.regression.ts (needs MARINARA_ENGINE_ROOT):
    • it imports PROFESSOR_MARI_ID from the Engine's packages/shared/src/constants/defaults.ts and asserts it equals LTM's PROFESSOR_MARI_CHARACTER_ID;
    • it reads the Engine's packages/shared/src/types/chat.ts and asserts that each field above is still declared;
    • add it to the LTM CI step proposed in #1414.

Validation:

  • npm run check
  • the new test against the local Engine checkout

Docs and tests only: no package rebuild or version bump.

Additional context

  • Limit: this check runs on LTM PRs against Engine staging. It can't stop an Engine release from breaking the import. It makes the break visible on the next LTM PR instead of through user reports.
  • Proper fix: an Engine API for chat summaries, which needs an Engine change and a higher minimum Engine version. Out of scope.
  • Why read the type file: the summary fields exist only as TypeScript types, and type checks don't run under tsx. The assistant id is a runtime constant, so that part is checked by value.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1418 Originally assigned to: @Promansis on GitHub. ## Summary Long-Term Memory imports chat summaries by reading Engine-owned chat metadata fields directly. It also hard-codes the id of the Engine's built-in assistant character. `engine-boundary.json` declares no private Engine imports, so the boundary checker can't see either dependency, and nothing documents or tests them. If the Engine renames or reshapes one of these fields, Sources quietly stops finding those summaries, with no error. If the assistant's id changes, the assistant and its chats start appearing as importable sources and places. ## Affected package `long-term-memory` 1.4.38 (`upstream/staging` 97c0486f8), `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/interop.ts`: | Field LTM reads | Read at | Feeds | Engine definition (2039583ca) | |---|---|---|---| | `daySummaries`, `weekSummaries` | `:190-191` | day and week conversation summaries | `packages/shared/src/types/chat.ts:764`, `:766` | | `summaryEntries` | `:196` | agent summary entries | `chat.ts:298` | | `summary` | `:218` | the single legacy summary | `chat.ts:288` | | `gamePreviousSessionSummaries` | `:231` | game session summaries | `chat.ts:616` | | `"__professor_mari__"` | `:74`, used at `:483`, `:514` and `routes.ts:755-757` | excludes the built-in assistant from sources and places | `packages/shared/src/constants/defaults.ts:21` (`PROFESSOR_MARI_ID`) | All five summary fields are members of the Engine's `ChatMetadata` interface. `docs/ARCHITECTURE.md` ("Boundaries") mentions none of these. ## Expected behavior - The Engine fields LTM depends on are listed in the package docs. - A test fails when the Engine stops declaring one of them. ## Actual behavior The dependency is invisible: - the boundary file lists no private imports; - the architecture doc doesn't mention these fields; - no test checks them. ## Steps to reproduce 1. Search `interop.ts` for `metadata.` reads; the fields above appear. 2. Check `engine-boundary.json` (`"privateEngineImports": []`) and `docs/ARCHITECTURE.md`: neither mentions them. ## Environment - Marinara Engine version: 2.5.0 line (local Engine checkout at 2039583ca) - Package version: long-term-memory 1.4.38 (`upstream/staging` 97c0486f8) - Install type: source (code audit) - OS + version: not platform-specific - Browser or app shell: any ## Logs, screenshots, or video Not applicable. ## Minimal fix 1. **Document.** In `docs/ARCHITECTURE.md` → Boundaries, add the table above: which fields, what each feeds, and where the Engine defines them. 2. **Check.** Add `tests/long-term-memory-engine-fields.regression.ts` (needs `MARINARA_ENGINE_ROOT`): - it imports `PROFESSOR_MARI_ID` from the Engine's `packages/shared/src/constants/defaults.ts` and asserts it equals LTM's `PROFESSOR_MARI_CHARACTER_ID`; - it reads the Engine's `packages/shared/src/types/chat.ts` and asserts that each field above is still declared; - add it to the LTM CI step proposed in #1414. Validation: - `npm run check` - the new test against the local Engine checkout Docs and tests only: no package rebuild or version bump. ## Additional context - **Limit:** this check runs on LTM PRs against Engine `staging`. It can't stop an Engine release from breaking the import. It makes the break visible on the next LTM PR instead of through user reports. - **Proper fix:** an Engine API for chat summaries, which needs an Engine change and a higher minimum Engine version. Out of scope. - **Why read the type file:** the summary fields exist only as TypeScript types, and type checks don't run under `tsx`. The assistant id is a runtime constant, so that part is checked by value. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:30:05 +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#722
No description provided.