mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1541] [Issue]: Long-Term Memory: a failed background rebuild shows its raw error text in Vault health #1513
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#1513
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 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1541
Originally assigned to: @Promansis on GitHub.
Summary
When a recall index rebuild fails, Long-Term Memory stores the raw error message in its index state, and
GET /integrityandGET /statusreturn it. Maintenance prints the integrity message as is, so a failed rebuild can put the vault's absolute path on screen, for exampleEISDIR: illegal operation on a directory, rename '/…/long-term-memory/indexes/recall.json.tmp-…' -> '/…/long-term-memory/indexes/recall.json'. The path includes the data folder and with it, usually, the OS user name.The rest of the package already keeps an unexpected failure's text in the server log and sends fixed text to the client (
routeError,rebuildAfterMutation, the scope-link rebuild). Since the debounced background rebuild (#1523), a failed rebuild after Accept no longer reaches the draft (Accept answerspendingand the draft stores no error); it reaches the index state, which is the remaining gap.One rebuild path does not log its failure at all: the index refresh the Engine runs after an embedding-connection change catches a failed rebuild and drops it.
Affected package
long-term-memory1.4.72 (upstream/stagingbcaebd07d), which has the debounced background rebuild. Line numbers below are onbcaebd07d(refreshed 2026-10-21; first checked on8b72729f1).S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memoryC=packages/long-term-memory/src/engine/packages/client/src/features/long-term-memoryExpected behavior
/integrityand/statussay that the latest index rebuild failed and to see the server log. They return no file paths or library messages.Actual behavior
markLtmIndexesFailed(S/persistence/index-state.ts:209-218): the synchronous rebuild (S/recall/rebuild.ts:234) and each background attempt (:298). It storeserror.message, up to 2,000 characters, inindexes/state.json.GET /integrityreturns it as theindex_rebuild_failedissue'smessage(S/maintenance/maintenance.ts:185) whenever the recall index itself is readable. Maintenance shows each issue as{severity}: {message}(C/settings/MaintenancePanel.tsx:627).GET /statusreturns it inindexes.warnings(S/routes/maintenance.ts:126). No client code readswarningstoday; the health pill and Activity showrebuildStatethrough localized labels.refreshLongTermMemoryIndexes(S/recall/rebuild.ts:436) runs a rebuild for the new embedding source in atrywhosecatch(:445-447) rethrows only a cancellation; any other failure is dropped without a log line. The refresh then reports "could not embed the vault with the new embedding source" without the cause.S/recall/rebuild-job.ts:46),rebuildAfterMutation, the scope-link rebuild,routeError(restore, identity repair), the Engine's error handler (POST /rebuild,POST /repair) and the Engine's recall. The threelogger.warnones keep their error in the log: the package'swarnputs an error passed first into the message. Source extraction's inline index load records its failure in the package's debug log (shown in Activity) and on the Sources page instead, as it does for every extraction failure.Steps to reproduce
long-term-memory/indexes/recall.jsonin the Engine's data folder with an empty folder.GET /api/long-term-memory/status.indexes.warningsis["EISDIR: illegal operation on a directory, rename '<data folder>/long-term-memory/indexes/recall.json.tmp-…' -> '<data folder>/long-term-memory/indexes/recall.json'"].recall.jsonback (the integrity check stops at an unreadable or missing index) and run the integrity check in Maintenance (GET /api/long-term-memory/integrity). Theindex_rebuild_failedissue shows the same text with both absolute paths.A background rebuild after Accept that fails on the disk the same way ends in the same function and stores its error the same way.
Minimal fix
One PR, patch bump. Two source files. The new text sends users to the server log, and the warnings that log a failed rebuild now carry the cause (the fix for warnings dropping their cause is already in).
markLtmIndexesFailed, store "The latest index rebuild failed; see the server log." for any failure, except a cancellation (AbortError), which keeps its own message ("This operation was aborted"). Both routes then serve the fixed text. The thrown error is unchanged, so every caller that logs it still does.refreshLongTermMemoryIndexes, log the failed rebuild it catches:logger.warn(error, "[ltm] Index rebuild for the new embedding source failed").## Unreleased: "After a recall index rebuild fails, the integrity check in Maintenance and the package status no longer show the raw error, which could include the vault's file paths. They now say that the latest index rebuild failed and to see the server log, which records the full error. A rebuild that fails while the Engine switches to a new embedding connection is now logged there too."Not included
LtmServiceError's message. No rebuild step throws one today.Regression proof
In
tests/long-term-memory-routes.regression.ts, in the existing settings case that replacesrecall.jsonwith a folder so the settings rebuild fails:/statusindexes.warningsequals the fixed text. Today it holds theEISDIR … renamemessage with the vault's absolute paths./integrityindex_rebuild_failedmessage equals the fixed text. Today it is the same raw message.The refresh's new log line is one line and has no dedicated test.
Environment
staging87d1ccadc)upstream/stagingbcaebd07d)Logs, screenshots, or video
None needed; the reproduction above uses a folder in place of the index file.
Additional context
Tracker item: hygiene add-on. Builds on #1523 (the debounced background rebuild), which moves the draft-accept failure into the index state, and on #1508, which makes the server log keep the cause. Both are merged. The error-message clean-up (#1506) deferred the draft-accept case until #1523.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: