[GH-ISSUE #1549] [Issue]: Long-Term Memory: the integrity report and model loading for import and re-extract still send raw server errors to the client #1517

Closed
opened 2026-10-22 04:02:53 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

After the error-message hygiene fix and the follow-up for the remaining raw error text, two paths still send an error's own text to the client. The text can hold absolute file paths:

  1. The integrity report. A note file or the event log that cannot be read is reported with the file system's message, for example EACCES: permission denied, open '/data/marinara/long-term-memory/vault/characters/char_mara.json'. Memory settings lists these messages. The identity-repair apply, repair and backup-restore responses carry the same report.
  2. A model resolver failure during import. Importing sources with extraction on asks the Engine for the memory model. Every failure there becomes a 400 ltm_model_configuration error with the failure's own message, and the import route sends it as is without logging it. That suits the Engine's setup messages, such as "Choose a language model connection before generating content.", but it also covers server failures. The Engine's corrupt key-file message, for example, names the key file's absolute path. Re-extracting one source wraps the resolver the same way: it logs the error, but still sends its text.

Affected package

long-term-memory 1.4.76 (upstream/staging 79d45f80e).

S = packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory
C = packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory

Expected behavior

  • No integrity issue carries a file-system message. A note file that cannot be read is named by its vault path, which the issue already has in path, and the message says the details are in the server log. The event log gets the same treatment. A note whose JSON or fields are broken keeps its parse or schema message, because that describes the note, not the server; a broken event-log line already shows its message the same way (malformed_event). Issue codes, severities, paths, note ids and counts stay as they are.
  • A model setup problem keeps the Engine's message and the 400 ltm_model_configuration error. Any other resolver failure is logged, and the client gets the route's fallback message, like any other unexpected failure after the hygiene fix.

Actual behavior

Line numbers are on upstream/staging 79d45f80e (refreshed 2026-10-21; first checked on 8b72729f1).

  • Integrity report. checkEventLog and the note loop use error.message as the issue message (S/maintenance/maintenance.ts:99 for the event log, :249 for a note). Both errors are already logged (:94, :244). GET /integrity (S/routes/maintenance.ts:240) returns the report, and Memory settings shows the first 20 issues as "severity: message" (C/settings/MaintenancePanel.tsx:625-627). The panel does not show path, so the raw message was the only place it named the file. The same report is part of the identity-repair apply response (S/identity/identity-repair.ts:134, :146), the repair response (S/maintenance/maintenance.ts:424) and the backup-restore response (S/persistence/backup-restore.ts:168, :178). The client does not read integrity from those three responses; it refetches /integrity.
  • Resolver on import. importPackageInterop wraps every resolveForRequest failure as a service error with the failure's message (S/sources/interop.ts:921-933). The import route hands it to routeError (S/routes/imports.ts:76), which sends a service error's message and does not log it.
  • Resolver on re-extract. S/routes/notes.ts:577-590 has the same wrap. The route logs every error first (:630), but the client still gets the text. The wrap also covers getLtmExtractionConfig, so a settings-file read failure is reported as a model configuration error with its own text.

The Engine's setup messages are plain Errors with fixed wording (packages/server/src/services/capability-packages/capability-language-model.service.ts:34, :90, :103, :136, :138, :147, :157, :159 and packages/server/src/services/llm/provider-registry.ts:68 in Marinara Engine). Other failures come from the same call, for example the key-file checks in packages/server/src/utils/crypto.ts:62, which puts the key file's path in its message, and database reads.

Steps to reproduce

  1. In the routes regression, make the stub resolver throw new Error("Encryption key file at /private/marinara/.encryption-key is corrupt.").
  2. Import a chat summary through POST /api/long-term-memory/import/source-notes with extraction on.
  3. The response is 400 { error: "Encryption key file at /private/marinara/.encryption-key is corrupt.", code: "ltm_model_configuration" }, and nothing reaches the server log.

For the integrity report: make one vault note file and events/log.jsonl unreadable (chmod 000), then call GET /api/long-term-memory/integrity. The malformed_note and event_log_unreadable issues carry EACCES: permission denied, open '<absolute path>'.

In normal use: vault files owned by another user, for example after running the Engine once with sudo, show their absolute paths in the integrity list in Memory settings.

Minimal fix

One PR, patch bump. Server only.

  • S/maintenance/maintenance.ts: the event log issue says "Event log could not be read. Details are in the server log." A note issue keeps the message of a SyntaxError or ZodError (the note's own content) and otherwise says "Note file could not be read or validated. Details are in the server log." The existing log calls stay.
  • S/package-runtime.ts: a resolvePackageLanguageModel helper, used by import and re-extract, turns only the Engine's setup messages into the 400 ltm_model_configuration service error and rethrows anything else, so routeError logs it and sends the route's fallback. The setup messages are matched by their opening words, the same way the package already reads provider messages; a reworded Engine message falls back to the generic path.
  • S/sources/interop.ts, S/routes/notes.ts: call the helper instead of their own wrap. Re-extract reads the extraction settings outside it, as import already does. An unreadable settings file then gets the route's fallback and the server log instead of a 400 with EACCES: permission denied, open '<absolute path>', and a settings file that fails validation gets 400 ltm_invalid_request with the same text instead of ltm_model_configuration.
  • CHANGELOG under ## Unreleased: "Two more places no longer show raw error text, which could include file paths. In the integrity list in memory settings, a note file or event log that cannot be read now says "Note file vault/… could not be read or validated." or "Event log could not be read.", followed by "Details are in the server log."; a note whose contents are broken still says what is wrong with it. When importing or re-extracting a source fails because the memory model or its settings could not be loaded for a server reason, Sources and Review show their usual "could not be imported" or "could not be re-extracted" message and the error goes to the server log. Messages that tell you how to fix the model setup, such as "Choose a language model connection before generating content.", show as before."

Not included

  • integrity stays in the identity-repair apply, repair and backup-restore responses. With the fix it carries no raw text, and dropping it would change three response schemas for no user gain.
  • Showing each issue's path in Memory settings. A parse error's message still does not say which file it is about; that is a client change.
  • A code on the Engine's setup errors, which would replace the wording match. That is an Engine change.
  • Other Engine environment errors from the resolver, such as an invalid ENCRYPTION_KEY value. They now get the fallback and the server log, like any other server failure.

Regression proof

  • tests/long-term-memory-routes.regression.ts:
    • scope-identity scenario, after the persona identity repair: one vault note and the event log made unreadable, one note file holding {, and one valid JSON note that fails the note schema. GET /integrity returns the two fixed messages with their vault paths, the parse error still mentions JSON, the schema error still shows the validation text, and the body does not contain the vault's absolute root.
    • scope-identity scenario, re-extract: the stub resolver throws the key-file message; expect 500 ltm_unexpected_failure with "Failed to extract long-term memory from source note". The existing missing-model case now also checks that the Engine's setup message is kept.
    • imports scenario: the same resolver failure on import; expect 500 ltm_unexpected_failure with "Failed to import long-term memory sources", and the error in the logger stub. The existing missing-model import now also checks the kept setup message.
  • The unreadable-file and resolver cases fail today with the raw text in the response, and pass with the fix. The parse and schema checks pass today and guard the messages that stay. Each changed call site and each half of the kept-message rule was also reverted on its own to check that a case fails.

Environment

  • Marinara Engine version: 2.5.1 (staging 87d1ccadc)
  • Package version: long-term-memory 1.4.76 (upstream/staging 79d45f80e)
  • Install type: source (code reading and regression tests)
  • OS + version: Linux for the unreadable-file cases (file permissions); the resolver case is not platform-specific
  • Browser or app shell: any

Logs, screenshots, or video

None. The regression cases above show the leaked text with made-up paths.

Additional context

Tracker item OT-12. Found by the review of #1542 (remaining raw error text). Follows the clean-up in #1506.

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 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1549 Originally assigned to: @Promansis on GitHub. ## Summary After the error-message hygiene fix and the follow-up for the remaining raw error text, two paths still send an error's own text to the client. The text can hold absolute file paths: 1. **The integrity report.** A note file or the event log that cannot be read is reported with the file system's message, for example `EACCES: permission denied, open '/data/marinara/long-term-memory/vault/characters/char_mara.json'`. Memory settings lists these messages. The identity-repair apply, repair and backup-restore responses carry the same report. 2. **A model resolver failure during import.** Importing sources with extraction on asks the Engine for the memory model. Every failure there becomes a 400 `ltm_model_configuration` error with the failure's own message, and the import route sends it as is without logging it. That suits the Engine's setup messages, such as "Choose a language model connection before generating content.", but it also covers server failures. The Engine's corrupt key-file message, for example, names the key file's absolute path. Re-extracting one source wraps the resolver the same way: it logs the error, but still sends its text. ## Affected package `long-term-memory` 1.4.76 (`upstream/staging` 79d45f80e). `S` = `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory` `C` = `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory` ## Expected behavior - No integrity issue carries a file-system message. A note file that cannot be read is named by its vault path, which the issue already has in `path`, and the message says the details are in the server log. The event log gets the same treatment. A note whose JSON or fields are broken keeps its parse or schema message, because that describes the note, not the server; a broken event-log line already shows its message the same way (`malformed_event`). Issue codes, severities, paths, note ids and counts stay as they are. - A model setup problem keeps the Engine's message and the 400 `ltm_model_configuration` error. Any other resolver failure is logged, and the client gets the route's fallback message, like any other unexpected failure after the hygiene fix. ## Actual behavior Line numbers are on `upstream/staging` 79d45f80e (refreshed 2026-10-21; first checked on 8b72729f1). - **Integrity report.** `checkEventLog` and the note loop use `error.message` as the issue message (`S/maintenance/maintenance.ts:99` for the event log, `:249` for a note). Both errors are already logged (`:94`, `:244`). `GET /integrity` (`S/routes/maintenance.ts:240`) returns the report, and Memory settings shows the first 20 issues as "severity: message" (`C/settings/MaintenancePanel.tsx:625-627`). The panel does not show `path`, so the raw message was the only place it named the file. The same report is part of the identity-repair apply response (`S/identity/identity-repair.ts:134`, `:146`), the repair response (`S/maintenance/maintenance.ts:424`) and the backup-restore response (`S/persistence/backup-restore.ts:168`, `:178`). The client does not read `integrity` from those three responses; it refetches `/integrity`. - **Resolver on import.** `importPackageInterop` wraps every `resolveForRequest` failure as a service error with the failure's message (`S/sources/interop.ts:921-933`). The import route hands it to `routeError` (`S/routes/imports.ts:76`), which sends a service error's message and does not log it. - **Resolver on re-extract.** `S/routes/notes.ts:577-590` has the same wrap. The route logs every error first (`:630`), but the client still gets the text. The wrap also covers `getLtmExtractionConfig`, so a settings-file read failure is reported as a model configuration error with its own text. The Engine's setup messages are plain `Error`s with fixed wording (`packages/server/src/services/capability-packages/capability-language-model.service.ts:34`, `:90`, `:103`, `:136`, `:138`, `:147`, `:157`, `:159` and `packages/server/src/services/llm/provider-registry.ts:68` in Marinara Engine). Other failures come from the same call, for example the key-file checks in `packages/server/src/utils/crypto.ts:62`, which puts the key file's path in its message, and database reads. ## Steps to reproduce 1. In the routes regression, make the stub resolver throw `new Error("Encryption key file at /private/marinara/.encryption-key is corrupt.")`. 2. Import a chat summary through `POST /api/long-term-memory/import/source-notes` with extraction on. 3. The response is 400 `{ error: "Encryption key file at /private/marinara/.encryption-key is corrupt.", code: "ltm_model_configuration" }`, and nothing reaches the server log. For the integrity report: make one vault note file and `events/log.jsonl` unreadable (`chmod 000`), then call `GET /api/long-term-memory/integrity`. The `malformed_note` and `event_log_unreadable` issues carry `EACCES: permission denied, open '<absolute path>'`. In normal use: vault files owned by another user, for example after running the Engine once with `sudo`, show their absolute paths in the integrity list in Memory settings. ## Minimal fix One PR, patch bump. Server only. - `S/maintenance/maintenance.ts`: the event log issue says "Event log could not be read. Details are in the server log." A note issue keeps the message of a `SyntaxError` or `ZodError` (the note's own content) and otherwise says "Note file <vault path> could not be read or validated. Details are in the server log." The existing log calls stay. - `S/package-runtime.ts`: a `resolvePackageLanguageModel` helper, used by import and re-extract, turns only the Engine's setup messages into the 400 `ltm_model_configuration` service error and rethrows anything else, so `routeError` logs it and sends the route's fallback. The setup messages are matched by their opening words, the same way the package already reads provider messages; a reworded Engine message falls back to the generic path. - `S/sources/interop.ts`, `S/routes/notes.ts`: call the helper instead of their own wrap. Re-extract reads the extraction settings outside it, as import already does. An unreadable settings file then gets the route's fallback and the server log instead of a 400 with `EACCES: permission denied, open '<absolute path>'`, and a settings file that fails validation gets 400 `ltm_invalid_request` with the same text instead of `ltm_model_configuration`. - **CHANGELOG under `## Unreleased`**: "Two more places no longer show raw error text, which could include file paths. In the integrity list in memory settings, a note file or event log that cannot be read now says "Note file vault/… could not be read or validated." or "Event log could not be read.", followed by "Details are in the server log."; a note whose contents are broken still says what is wrong with it. When importing or re-extracting a source fails because the memory model or its settings could not be loaded for a server reason, Sources and Review show their usual "could not be imported" or "could not be re-extracted" message and the error goes to the server log. Messages that tell you how to fix the model setup, such as "Choose a language model connection before generating content.", show as before." **Not included** - `integrity` stays in the identity-repair apply, repair and backup-restore responses. With the fix it carries no raw text, and dropping it would change three response schemas for no user gain. - Showing each issue's `path` in Memory settings. A parse error's message still does not say which file it is about; that is a client change. - A code on the Engine's setup errors, which would replace the wording match. That is an Engine change. - Other Engine environment errors from the resolver, such as an invalid `ENCRYPTION_KEY` value. They now get the fallback and the server log, like any other server failure. ## Regression proof - `tests/long-term-memory-routes.regression.ts`: - scope-identity scenario, after the persona identity repair: one vault note and the event log made unreadable, one note file holding `{`, and one valid JSON note that fails the note schema. `GET /integrity` returns the two fixed messages with their vault paths, the parse error still mentions JSON, the schema error still shows the validation text, and the body does not contain the vault's absolute root. - scope-identity scenario, re-extract: the stub resolver throws the key-file message; expect 500 `ltm_unexpected_failure` with "Failed to extract long-term memory from source note". The existing missing-model case now also checks that the Engine's setup message is kept. - imports scenario: the same resolver failure on import; expect 500 `ltm_unexpected_failure` with "Failed to import long-term memory sources", and the error in the logger stub. The existing missing-model import now also checks the kept setup message. - The unreadable-file and resolver cases fail today with the raw text in the response, and pass with the fix. The parse and schema checks pass today and guard the messages that stay. Each changed call site and each half of the kept-message rule was also reverted on its own to check that a case fails. ## Environment - Marinara Engine version: 2.5.1 (`staging` 87d1ccadc) - Package version: long-term-memory 1.4.76 (`upstream/staging` 79d45f80e) - Install type: source (code reading and regression tests) - OS + version: Linux for the unreadable-file cases (file permissions); the resolver case is not platform-specific - Browser or app shell: any ## Logs, screenshots, or video None. The regression cases above show the leaked text with made-up paths. ## Additional context Tracker item OT-12. Found by the review of #1542 (remaining raw error text). Follows the clean-up in #1506. ## 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-11-07 16:35:53 +07:00
  • closed this issue
  • removed the
    in-pr
    label
Author
Owner

@Promansis commented on GitHub (Oct 21, 2026):

Fixed in staging by #1551 (long-term-memory 1.4.78).

<!-- gh-comment-id:6322786648 --> @Promansis commented on GitHub (Oct 21, 2026): Fixed in staging by #1551 (long-term-memory 1.4.78).
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#1517
No description provided.