[PR #559] [MERGED] Fix Memory Recall storing rerolls #4674

Closed
opened 2026-10-22 04:09:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/559
Author: @TheLonelyDevil9
Created: 5/8/2026
Status: ✅ Merged
Merged: 5/9/2026
Merged by: @TheLonelyDevil9

Base: main ← Head: fix/issue-548-memory-reroll-recall


📝 Commits (5)

  • 750c5f6 Document draft PR issue workflow
  • 3818ff2 Fix memory recall reroll invalidation
  • 642c7a8 Avoid unnecessary memory invalidation for inactive swipe deletion
  • d111440 Address memory recall review feedback
  • 4c754f2 Document issue ownership tagging workflow

📊 Changes

4 files changed (+116 additions, -7 deletions)

View changed files

📝 AGENTS.md (+3 -0)
📝 CLAUDE.md (+3 -0)
📝 packages/server/src/services/storage/chats.storage.ts (+10 -0)
📝 packages/server/test/memory-recall.test.ts (+100 -7)

📄 Description

What?

Fixes Memory Recall so discarded reroll/swipe content does not stay embedded in chat memory.

  • Invalidates memory chunks when adding a non-silent swipe/reroll changes the active message content.
  • Invalidates memory chunks when switching the active swipe.
  • Invalidates memory chunks when deleting a swipe, including cases where the active content changes.
  • Adds regression coverage proving a rerolled assistant message rebuilds memory from the selected swipe instead of the discarded response.
  • Documents the project workflow expectation that issue implementation effort should be claimed with an early draft PR.

Why?

Users reported that rerolled roleplay responses could still be saved into Memory Recall and later influence the narrative, even though those discarded responses are not the visible conversation outcome.

How?

Message edits and deletes already invalidated memory chunks from the affected message timestamp onward. Swipe operations also mutate the canonical messages.content field, but did not invalidate already-built chunks. This change reuses the same invalidation helper in the swipe mutation paths so the next memory refresh or automatic chunking pass rebuilds from the currently active response text.

Silent swipe insertion is left unchanged because it only adds alternate swipe rows without changing the active message content.

Testing?

  • pnpm --filter @marinara-engine/server exec tsx --test test/memory-recall.test.ts
  • pnpm check

Screenshots (optional)

Not included. This is a server-side Memory Recall state correctness fix with no UI changes.

Anything Else?

Closes #548.

Summary by CodeRabbit

  • Bug Fixes

    • Memory is now invalidated and refreshed when a message's active response/swipe changes, preventing stale cached memory chunks.
  • Tests

    • Added an integration test covering the message reroll/swipe flow to verify memory chunks are rebuilt correctly.
  • Documentation

    • Updated contributor guidelines with coordination rules for checking existing work, opening draft PRs when starting implementation, and tagging issue owners.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/559 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 5/8/2026 **Status:** ✅ Merged **Merged:** 5/9/2026 **Merged by:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Base:** `main` ← **Head:** `fix/issue-548-memory-reroll-recall` --- ### 📝 Commits (5) - [`750c5f6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/750c5f61a2c3794907272babd4c9fa4c5fb085da) Document draft PR issue workflow - [`3818ff2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3818ff2f96b3a5816495a7e0b3b80766413d7693) Fix memory recall reroll invalidation - [`642c7a8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/642c7a8ce3230e83ffa0ee37ab64ebb3d9dd75e3) Avoid unnecessary memory invalidation for inactive swipe deletion - [`d111440`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d111440a99b1baa39467724fadf528f3cb7aa882) Address memory recall review feedback - [`4c754f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4c754f22f3878e07b89e95cfa8ece6b54d789c74) Document issue ownership tagging workflow ### 📊 Changes **4 files changed** (+116 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+3 -0) 📝 `CLAUDE.md` (+3 -0) 📝 `packages/server/src/services/storage/chats.storage.ts` (+10 -0) 📝 `packages/server/test/memory-recall.test.ts` (+100 -7) </details> ### 📄 Description ## What? Fixes Memory Recall so discarded reroll/swipe content does not stay embedded in chat memory. - Invalidates memory chunks when adding a non-silent swipe/reroll changes the active message content. - Invalidates memory chunks when switching the active swipe. - Invalidates memory chunks when deleting a swipe, including cases where the active content changes. - Adds regression coverage proving a rerolled assistant message rebuilds memory from the selected swipe instead of the discarded response. - Documents the project workflow expectation that issue implementation effort should be claimed with an early draft PR. ## Why? Users reported that rerolled roleplay responses could still be saved into Memory Recall and later influence the narrative, even though those discarded responses are not the visible conversation outcome. ## How? Message edits and deletes already invalidated memory chunks from the affected message timestamp onward. Swipe operations also mutate the canonical `messages.content` field, but did not invalidate already-built chunks. This change reuses the same invalidation helper in the swipe mutation paths so the next memory refresh or automatic chunking pass rebuilds from the currently active response text. Silent swipe insertion is left unchanged because it only adds alternate swipe rows without changing the active message content. ## Testing? - [ ] `pnpm --filter @marinara-engine/server exec tsx --test test/memory-recall.test.ts` - [ ] `pnpm check` ## Screenshots (optional) Not included. This is a server-side Memory Recall state correctness fix with no UI changes. ## Anything Else? Closes #548. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Memory is now invalidated and refreshed when a message's active response/swipe changes, preventing stale cached memory chunks. * **Tests** * Added an integration test covering the message reroll/swipe flow to verify memory chunks are rebuilt correctly. * **Documentation** * Updated contributor guidelines with coordination rules for checking existing work, opening draft PRs when starting implementation, and tagging issue owners. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:41 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4674
No description provided.