mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1556] [Issue]: Long-Term Memory: a full debug log is rewritten in full for every new line #1543
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#1543
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 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1556
Originally assigned to: @Promansis on GitHub.
Summary
Long-Term Memory keeps its debug log at most 2 MB. Once the log is full, every new debug line reads the whole file, keeps the newest lines up to just under 2 MB and writes it back, all while holding the vault lock. Every recall and extraction writes debug lines, so a long-running install pays a full 2 MB rewrite for each one, and saves and recalls wait behind it. Trimming well below the cap would make the next lines plain appends again.
Affected package
long-term-memory1.4.80maintenance/debug-log.ts)Expected behavior
Actual behavior
appendBounded(S/maintenance/debug-log.ts:143-165) trims toLTM_DEBUG_MAX_LOG_BYTES - lineBytes, so the file stays within one line of the cap.recordLtmDebugEvent(:182-200) runs that append underwithLtmVaultLock. The debug setting in Memory Settings doesn't gate these writes: recall (recall/generation-injection.ts:247), extraction and draft apply all record events.S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memorySteps to reproduce
tests/long-term-memory-debug-log.regression.tsdoes.Minimal fix
S/maintenance/debug-log.ts: inappendBounded, keep the newest complete lines within a trim target of three quarters ofLTM_DEBUG_MAX_LOG_BYTES(1.5 MB) instead of the cap minus the new line. Nothing else changes.tests/long-term-memory-debug-log.regression.ts: after the log overflows, its size is at most the trim target, and the next event grows it by exactly that event's line.Environment
Logs, screenshots, or video
Found by reading the code while reviewing the runtime architecture audit. The trade-off is that the log keeps about 1.5 to 2 MB of history instead of always 2 MB.
Additional context
An earlier plan moved the debug log onto its own lock. That was dropped: it could make a backup restore fail halfway through swapping the vault folder. This issue keeps the debug log on the vault lock and only removes the repeated rewrite.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Promansis commented on GitHub (Oct 22, 2026):
Fixed in staging by #1557 (
a6e2b20ce), released as Long-Term Memory 1.4.82.