mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1506] [Issue]: Long-Term Memory: raw server errors reach the client, and stale comments and help text about usage, backups and existing notes #1494
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1494
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1506
Originally assigned to: @Promansis on GitHub.
Summary
Four small clean-ups from the runtime, recall-scoring and pipeline audits, re-checked at the staging tip:
messageto the client, and the client shows it as is. Even when the server sends its generic fallback, the screen shows that ("Failed to …") instead of the action's own message.recall/usage.tsdescribe per-chat statistics that 1.4.42 stopped keeping.retrievalblock has no comment saying it is legacy, so it looks safe to delete. It isn't.ARCHITECTURE.mddoesn't say what the existing-note settings do.skipStructuredBackfilloption is alwaystrue. It stays, by decision (see Minimal fix).Re-checking corrected two tracker claims:
skipStructuredBackfill.Affected package
Re-checked 2026-10-21 at
upstream/stagingedb9c4928(long-term-memory 1.4.57, built on the Engine's host, capability API 1.341): the fix applies unchanged there; line numbers are at the commit named below.long-term-memory1.4.54 (upstream/stagingb1873710f). PR #1473 (headc4b1c0192) shifts only thesource-processing.tsline below; it is given at both commits.S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memorySH=packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memoryC=packages/long-term-memory/src/engine/packages/client/src/features/long-term-memoryExpected behavior
usage.jsonholds today.Actual behavior
RT-4: raw error messages
The tracker listed five locations. At the tip:
S/routes/shared.ts:37(routeError, fallback branch)error.messageof any unexpected error, as a 500 withltm_unexpected_failure. It is not logged.S/routes/shared.ts:80(rebuildAfterMutation)C/vault/MemoryVault.tsx:1534,:1704) and into the settings rebuild message (C/settings/MaintenancePanel.tsx:446).:71-77.S/routes/maintenance.ts:277-281(identity repair apply)error.messageof a non-LtmIdentityRepairErroras a 500 with codeidentity_repair_failed, which nothing reads. It is not logged.S/service-error.ts:25-26(ltmErrorResponse, non-service branch)error.message. Only reachable fromrouteError's duck-typed branch (S/routes/shared.ts:25-29) for an error-like object that failsisLtmServiceError, such as a library error with a stringcodeand no numericstatusCode. Not in the tracker.S/identity/scope-links.ts:60(applyLtmScopeLinksToDerivedNotes, deferred rebuild)POST /notes/:id/scope/apply-to-derived. Already logged at:57. Found while building the patch; not in the tracker.shared.ts:80.S/drafts/reconciliation.ts:941-949(draft accept, failed rebuild)indexRebuildErrorand returned asindexRebuild.error, which Review shows (C/review/ReviewQueue.tsx:1180). Logged at:950.S/routes/shared.ts:23;maintenance.ts:143,:148;notes.ts:688,:702;settings.ts:55S/routes/maintenance.ts:258LtmIdentityRepairErrormessage, written for users:254.S/routes/notes.ts:586The tracker's
:275is today's:279.Correction. The tracker says that since 1.4.36 (#1375) the client shows localized text instead. It doesn't:
failedResponseError(C/api.ts:155-166) keeps the server'serrorstring.errorMessage(:149-152) shows that string, and falls back to localized text only when the server sent none.routeError; Reset (S/routes/settings.ts:30-37) is one. There, a failure reaches the Engine's error handler (Marinara-Engine/packages/server/src/middleware/error-handler.ts:36-42, reached because package routes are added withapp.route). The handler logs the error and sends{ "error": "Internal Server Error" }with no code, so today a failed Reset shows "Internal Server Error".RT-8: stale usage comment
S/recall/usage.ts:44-45says the file "only holds per-chat injection stats and the receipt de-duplication list".:48logs "usage statistics restart from empty".Since 1.4.42 (#1443),
recordLongTermMemoryInjection(:122) and retention (S/persistence/retention.ts:162-163) both emptychats. The file now holds onlyacceptedReceipts, the receipt de-duplication list.RS-4: legacy retrieval block
maxVectorCandidates(SH/schema.ts:1340) is one field ofltmRetrievalConfigShape(:1327-1348). That whole block is legacy:settings.retrieval(:3261), so older backups restore. Restore validates the block and then ignores it..strict(), so deleting any of its fields would make older backups that contain that field fail to restore. A comment on the one field would cover only part of this.The RT-3 probe's check 13c (private) confirms such a backup restores today.
PL-3: existing-note settings and the backfill option
The existing-note settings are not hidden; Settings shows them in the extraction tab (
C/settings/MemorySettings.tsx:848-875). What they do is undocumented:getExistingTypedNotes(S/extraction/source-extraction.ts:298-321, called at:484-496) runs normal recall over the source text, bounded byexistingNoteMaxChunksandexistingNoteMaxTokens.S/extraction/dedup.ts:22);S/identity/subject-identity.ts:1216-1243);S/extraction/evidence-unit-compiler.ts:47).baseExtractionOptions(:522-543) has noexistingNotes.C/locales/en.json:427says "Maximum tokens from those existing chunks included in the extraction request." That's wrong.:421("considered while checking context and possible overlap") is close enough.ARCHITECTURE.md's Write Flow (packages/long-term-memory/docs/ARCHITECTURE.md:85-102) doesn't mention the step.Correction: the tracker says the normalizer's backfill default (
addStructuredUnits = true,S/extraction/structured-summary-normalizer.ts:210) is dead because every compile caller passesskipStructuredBackfill: true. That's half right:compileEvidenceUnitExtractionturnsskipStructuredBackfillintoaddStructuredUnits: !skip(S/extraction/evidence-unit-extraction.ts:1534,:1546). All three production callers passtrue:S/extraction/source-extraction.ts:621;S/extraction/source-processing.ts:234(:235at #1473);S/identity/subject-choice-review.ts:179.S/extraction/source-extraction.ts:554-565) doesn't pass the flag, so the default backfill runs on every extraction. On the private 15-source vault copy it adds units for 13 sources, 238 units in all (counted with a private script). Deleting the default would change extraction output.Steps to reproduce
Error("ENOENT: open '/srv/marinara/…'"), for example with an unreadable vault file, and call it. The response body is{ "error": "ENOENT: open '/srv/marinara/…'", "code": "ltm_unexpected_failure" }, the UI shows that text, and nothing is logged.Minimal fix
One PR, patch bump. Each part is independent and can be dropped from the PR.
RT-4
S/routes/shared.ts:30-44: log every unexpected error (logger.error(error, "[ltm] Unexpected failure in route")) and sendfallback. TheAggregateErrorbranch (:30-36) already does this, so the two branches merge into one and the code gets shorter.S/routes/shared.ts:80: senderror instanceof LtmServiceError ? error.message : "Index rebuild failed".S/routes/maintenance.ts:277-281: for an error that is not anLtmIdentityRepairError, log it and send the existing fallback text with codeltm_unexpected_failureinstead ofidentity_repair_failed. Nothing reads the old code, which the grep ofsrcandtestsconfirms. The patch does this by callingrouteError, like the fork-repair routes beside it:LtmIdentityRepairErroris a service error, so its status, code and message are unchanged.S/service-error.ts:25-26: the patch removes the non-service branch, soltmErrorResponsetakes only anLtmServiceError; its only caller,routeError, checks first. It also exportsisLtmServiceErrorandrouteErroruses it directly, so every error that is not a service error is logged (the duck-typed branch sent such errors on without logging). A cancelled request (AbortError) is not logged.User-facing plain errors. Route-reachable messages written for users but thrown as plain
Errorbecome the existing service-error classes, so their text still shows: draft accept (LtmDraftApplyError, 400 or 409), fork repair, note type change, note not found, backup restore and the rejected-suggestion race (LtmServiceError). Internal and invariant errors stay plain.S/identity/scope-links.ts:60: same change asshared.ts:80.Client,
C/api.ts:163: widen the one condition infailedResponseError:errorMessage(error, fallback)caller then shows its own localized message for an unexpected failure, for example "Could not reset memory settings." (C/settings/MaintenancePanel.tsx:455).error.messagestill holds the server text for debugging.ltm_note_not_found, keep showing the server's message.tests/long-term-memory-browser.regression.ts:1351,:1628,:3642) keep showing it, so no test changes.This line was prototyped first; the results are under Regression proof.
RT-8:
S/recall/usage.ts:44-45: say the file holds only the receipt de-duplication list (acceptedReceipts), because 1.4.42 stopped keeping per-chat counters.:48: say receipt de-duplication restarts from empty.RS-4: above
ltmRetrievalConfigShape(SH/schema.ts:1327), add a comment like this:This is one comment for the whole block instead of one on
maxVectorCandidates.PL-3 (docs and help text only)
packages/long-term-memory/docs/ARCHITECTURE.mdWrite Flow (:85-102): add one paragraph. Before compiling, extraction recalls up toexistingNoteMaxChunkschunks andexistingNoteMaxTokenstokens of existing memories that match the source. The server uses them to drop duplicates and to pick the memories a unit updates, and never sends them to the model.C/locales/en.json:427: change it to something like "Maximum tokens of those existing memories used to match and merge extracted details."skipStructuredBackfilloption, and keep the normalizer default. No source or test file changes.tests/long-term-memory-extraction-graph.regression.ts:1235passesfalseto turn backfill on, and so tests the normalizer's "static lore must not synthesize a timeline event" rule through compile.CHANGELOG under
## Unreleased: one bullet for RT-4, such as "Unexpected server errors are logged, and the interface shows the action's own error message instead of the raw server error." RT-8, RS-4 and PL-3 need none; the help-text fix is user-visible but small. Add it to the same bullet if wanted.Not included
LtmServiceError.identity-repair.ts:155-157), per-source import failures (sources/interop.ts:1018,extraction/source-processing.ts:408, shown atC/sources/SourcesWorkspace.tsx:1380,:2639), and preflight blockers. Draft accept'sindexRebuild.errorgets its own issue after RT-1, which moves that error into the index state.Regression proof
Write first:
RT-4: in
tests/long-term-memory-routes.regression.ts, callrouteError(new Error("ENOENT: open '/private/path'"), "Fallback text")and assert:codeltm_unexpected_failureanderror"Fallback text";Make the identity repair apply route fail with a plain
Errorand assert that the body holds the fallback withltm_unexpected_failure. A rebuild failure with a plainErrorreturnserror: "Index rebuild failed". As built: the fixture'sgetChatthrows for achat-unreadablescope, the runtime logger stub records errors, and a library error with a stringcodeand no status covers the old duck-typed branch. The cases sit in the scope-identity scenario after the persona identity repair.RT-4 client: in
tests/long-term-memory-source-pagination.regression.ts, beside the existingerrorMessageandfailedResponseErrorcases (:255-280), port the five cases of a private probe script. With the fallback "Could not reset memory settings.":ltm_unexpected_failureand a 500{ "error": "Internal Server Error" }both show the fallback;{ "error": "Memory not found.", "code": "ltm_note_not_found" }still shows "Memory not found.";Today 3 of 5 pass; the two unexpected-failure cases show "Failed to reset settings" and "Internal Server Error". With the prototype line, 5 of 5 pass, and the existing source-pagination regression still exits 0.
RT-8, RS-4, PL-3: comment, docs and help text only, so no dedicated test.
Environment
stagingcheckout, unchanged)upstream/stagingb1873710f)Logs, screenshots, or video
Output of the private backfill-count script on the private vault copy:
{"sources":15,"structured":13,"sourcesWithBackfill":13,"unitsAdded":238}.Additional context
Tracker items:
Related: #1375, #1443.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: