mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2293] [Issue]: 09-CHAT-STORAGE-delete-derived-state-cleanup leaves stale Memory Recall chunks after message delete #1128
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1128
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 (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2293
Originally assigned to: @Promansis on GitHub.
Summary
09-CHAT-STORAGE-delete-derived-state-cleanup: deleting one chat message or bulk-deleting messages on the refactor branch does not prune or rebuild Memory Recall chunks that were built from the deleted messages. Those stale chunks can still be recalled and injected into later prompts.Linked parity tracker: #2268.
Expected behavior
Deleting a message or bulk-deleting messages should keep derived chat state coherent. Legacy removes Memory Recall chunks at or after the deleted message timestamp, so deleted message content is not left in recall storage or future prompt recall.
Acceptance criteria:
09-CHAT-STORAGE-delete-derived-state-cleanupas resolved for the memory-delete gap.Actual behavior
Refactor message/bulk delete removes message rows and swipe sidecars, deletes tracker snapshots for deleted messages, syncs visible tracker state, and refreshes timeline/count caches. It does not update the chat
memoriesarray used by Memory Recall, so previously rebuilt/imported chunks can continue to mention deleted messages.The prompt assembler reads stored chat memories through
storage.listChatMemoriesorchat.memories, ranks them, and emits a<memories>block. That makes the stale chunk user-visible in later generation.Steps to reproduce
Expected: the chunk that references deleted content is gone or rebuilt from remaining messages.
Actual: the stale memory chunk remains available for recall.
Impact area
Environment
refactor@37585ab9from #2268Logs, screenshots, or video
Static parity proof only; no runtime logs.
Files inspected:
main:packages/server/src/services/storage/chats.storage.ts:140definesinvalidateMemoryChunksFrom.main:packages/server/src/services/storage/chats.storage.ts:715calls that invalidation after single-message delete.main:packages/server/src/services/storage/chats.storage.ts:723calls that invalidation after bulk message delete.src-tauri/src/commands/storage/chats.rs:616bulk-deletes messages/swipes and tracker snapshots, but does not prune chatmemories.src/features/catalog/chats/hooks/use-chats.ts:547updates visible message cache/count around delete.src/engine/generation/prompt-assembly.ts:1832reads stored memories, andsrc/engine/generation/prompt-assembly.ts:1855injects recalled memory content into<memories>.Regression notes
This worked on legacy
main: message delete and bulk delete invalidated Memory Recall chunks from the affected message timestamp onward. The refactor changed Memory Recall storage shape from a sidecar table to chat-array records, but the delete path does not mirror the invalidation behavior.Additional context
Batch 10 parityscan found chat/gallery delete cleanup otherwise stronger in refactor: chat and group delete remove scoped gallery rows/files, message/swipe rows, tracker snapshots, scene references, and related caches. This issue is limited to stale Memory Recall chunks from deleted messages under
09-CHAT-STORAGE-delete-derived-state-cleanup.Follow-up surfaces not chased: Target 4 broader managed-asset cleanup and Target 2 broad storage cascade proof.
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: