mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1508] [Issue]: Long-Term Memory: warnings in the server log lose the error that caused them #1497
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#1497
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/1508
Originally assigned to: @Promansis on GitHub.
Summary
Long-Term Memory writes most of its warnings pino style, with the error first:
logger.warn(error, "[ltm] Deferred index rebuild after maintenance mutation"). On the real Engine those warnings reach the server log without the error. The line says that something failed but never why.The package runtime turns the error-first form into the host's message-first form,
host.logger.warn(message, error). The Engine passes that to pino as it is, and pino only uses arguments after the message to fill printf placeholders such as%s; an argument with no placeholder is dropped. So the error is lost. When the message does have a placeholder ("… for chat %s", chat.id), pino fills it with the error instead of the id, and the id is lost.27 warnings in the package are written error first, among them a failed recall index rebuild after an edit, a settings save or a maintenance action (
rebuildAfterMutation), the scope-link rebuild, retention, recall's shared-history lookup and the legacy settings adoption.logger.error(error, message)is not affected: the host'serrortakes the error first and the Engine passes it to pino that way.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.55 (upstream/staging8b72729f1).S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memoryExpected behavior
A warning logged with its error first shows the error in the server log: its message, and its stack like the package's
logger.errorlines. A warning whose message has an id placeholder shows the id.Actual behavior
logger.warninS/package-runtime.ts:177-185accepts a string first (passed on unchanged) or anything else first. For the second form it callshost.logger.warn(typeof second === "string" ? second : "Long-Term Memory warning", first, ...args): the message, then the error, then any printf arguments.packages/server/src/services/capability-packages/capability-module-runtime.service.ts:126-127in Marinara-Engine) iswarn: (message, ...args) => Reflect.apply(logger.warn, logger, [message, ...args]), whereloggeris the Engine's pino instance.%s,%d,%o, …) and ignores the rest. Itserrserializer only applies to an error passed first.Result through the Engine's pino 10.3.1 with the host's mapping (probe messages):
msgtodaywarn(error, "Long-Term Memory background rebuild failed")Long-Term Memory background rebuild failed(no error)warn(error, "[ltm] Failed to delete draft %s", "draft-a")[ltm] Failed to delete draft Error: EISDIR: illegal operation on a directory, read(no id)warn(error)Long-Term Memory warningerror(error, "…")errobject with type, message and stackCallers on
8b72729f1: 18 pass an error and a plain message, 8 pass an error and a message with a%sid (S/drafts/draft-store.ts:343,S/maintenance/legacy-adoption.ts:38,S/maintenance/maintenance.ts:237,S/persistence/index-state.ts:87,S/persistence/retention.ts:97,S/recall/generation-injection.ts:90,:135,:318), and one passes an array of note ids (S/maintenance/note-transfer.ts:303). Four pass a string first and are fine.Steps to reproduce
const log = pino(); const error = new Error("disk full");log.warn("Long-Term Memory background rebuild failed", error)(what the package runtime sends): the line has"msg":"Long-Term Memory background rebuild failed"and noerr.log.warn(error, "object-first form"): the line has"err":{"type":"Error","message":"disk full","stack":…}.In the package: configure the runtime with a host logger that, like pino, keeps only a warning's message, and call
logger.warn(new Error("cause text"), "message"). The host receives"message".Minimal fix
One PR, patch bump. Only
S/package-runtime.ts, inlogger.warn.`${message}: ${cause}`, where the cause is the error's stack (or its message if it has none), orString(value)for anything that is not an error. Pass the printf arguments on unchanged, so%sgets the id again."Long-Term Memory warning"fallback as they are. The host contract (warn(message, ...args)) and the Engine stay unchanged, and the result works with any host, not only pino.## Unreleased: "Long-Term Memory warnings in the server log now include the error that caused them. Before, the Engine's log dropped that error, so a warning such as a failed index rebuild gave no cause, and a warning that names a chat, draft or file showed the error's message in place of that name."Not included
warnan error-first form: the package must work with the Engines in its range, and the host contract is message first.util.inspectof the error: it would also print the error's own fields, which for some provider errors include the request body.Regression proof
tests/long-term-memory-runtime.regression.ts, after the existing host-swap checks: configure a host whosewarnrecords only its first argument, as pino does, calllogger.warn(new Error("cause text"), "message"), and expect the recorded message to start withmessage:and containcause text. Fails today: the recorded message ismessage.tests/long-term-memory-storage.regression.ts: the retention check asserted the old shape (the error as the second argument). It now expects[ltm] Deferred activity index pruning during retention:followed by the cause, and also fails today.Environment
staging2039583ca), pino 10.3.1upstream/staging8b72729f1)Logs, screenshots, or video
From the Engine's pino with the host's mapping (stack frames cut):
Additional context
Tracker item OT-10. Found while checking where a failed recall index rebuild is logged. The hygiene add-on (raw rebuild errors in the index state) points users to the server log and depends on this fix.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: