mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1443] [Issue]: Long-Term Memory: retention still keeps dead usage cleanup, 180 days of accepted receipt ids, and invalidated drafts forever #731
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#731
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 17, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1443
Originally assigned to: @Promansis on GitHub.
Summary
#1404 (1.4.42) stopped writing per-memory usage counters and started deleting finished drafts. It left three things for a follow-up:
usage.jsongains one id per injected reply, and the whole file is read and rewritten under the vault lock on every one of those replies. The ids only stop the same prepared prompt from being recorded twice. Engine ignores the result: at 2039583ca,long-term-memory-runtime.ts:138-148only logs a failure.Affected package
long-term-memory1.4.46 (upstream/staging60d50d47d).S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memoryS/retention.ts::154-189) prunesusage.chats(:158-175) and expiresacceptedReceiptsafterreceiptRetentionDays(:176-183).:236-260) deletes finished drafts.usageChatsPrunedresult field is at:135,:168and:267.S/storage.ts:1301-1313: permanent delete removes the memory fromusage.chats.S/usage.ts:107-145:recordLongTermMemoryInjectionwriteschats: {}and records the accepted id.S/storage.ts:584(a targeted detail removed) and:1236(a targeted memory deleted).ReviewQueue.tsx:1344-1372offers "Discard invalidated draft", which sendsDELETE /drafts/:id.Expected behavior
Actual behavior
As in the summary.
Steps to reproduce
Code reading at
60d50d47d. From the 2026-10-08 vault copy:acceptedReceiptsheld 810 ids (about 55 KB) after about 2.5 weeks of use, with a 180-day window.Minimal fix
One PR, patch bump.
usage.chatsloop (:158-175) with: ifusage.chatshas any entries, set it to{}and mark usage changed.usageChatsPruned.S/storage.ts:1301-1313).usageRetentionDaysin the settings schema (shared/.../schema.ts:1360,S/default-config.ts:6) so older settings files and backups still parse. Add a comment that nothing reads it.acceptedReceiptsentries older than one day, as a named constant besideRETENTION_INTERVAL_MS, instead ofreceiptRetentionDays.usage.tsdoesn't change.receiptRetentionDays, because they hold each chat's last recall.invalidatedto the statuses step 6 deletes, with the sameauditWindowDayscutoff (30 days by default). Invalidation setsupdatedAt, so the window counts from the invalidation.S/retention.ts:22.## Unreleased:usage.jsonstays small;Not included: the per-chat receipt files and their 180-day window. There is one small file per chat, and it holds that chat's last recall.
Regression proof
tests/long-term-memory-storage.regression.ts, beside the #1404 retention cases:usage.chatsstill has old counters ends withchats: {}after retention.auditWindowDaysis removed, a recent one is kept, and an old pending draft is kept.usage.json.Also run:
index-keys(the reserved-key check at:711);runtime(the duplicate-receipt case near:1700);routesandroutes-drafts.Environment
staging2039583ca)upstream/staging60d50d47d)Logs, screenshots, or video
None. Follow-ups recorded in the #1404 run, confirmed by reading the code at
60d50d47d. The Engine's handling of the dispatch result was read in the shared host checkout at 2039583ca.Additional context
Follow-up to #1404. It doesn't share files with the picker and branch recall follow-up #1442, so both can run in parallel.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: