[PR #7152] [MERGED] Fix memory controls, character titles and All lorebook sorting #7503

Closed
opened 2026-10-23 04:20:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7152
Author: @SpicyMarinara
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/open-issues-7149-7151


📝 Commits (5)

  • ca4fb3c chore: start fixes for Echo, memory recall and persona picker
  • c7aa6b1 Merge branch 'staging' into fix/open-issues-7149-7151
  • f11b4e9 fix: keep memory recall modes exclusive and show character titles
  • 324596d Merge remote-tracking branch 'origin/fix/open-issues-7149-7151' into fix/open-issues-7149-7151
  • a291d8f fix: persist memory pause and keep All lorebooks sorted

📊 Changes

19 files changed (+898 additions, -145 deletions)

View changed files

📝 CHANGELOG.md (+8 -0)
📝 e2e/advanced-memory.e2e.ts (+148 -11)
📝 e2e/mobile-echo-window.e2e.ts (+85 -0)
📝 e2e/play-as-character-folder.e2e.ts (+22 -4)
📝 packages/client/src/components/chat/AdvancedMemoryProgress.tsx (+9 -8)
📝 packages/client/src/components/chat/AdvancedMemorySettings.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+11 -6)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+5 -3)
📝 packages/client/src/components/chat/QuickPersonaSwitcher.tsx (+4 -3)
📝 packages/client/src/components/chat/QuickSwitcherMobile.tsx (+4 -3)
📝 packages/client/src/components/panels/LorebooksPanel.tsx (+1 -29)
📝 packages/client/src/hooks/use-chats.ts (+43 -1)
📝 packages/client/src/localization/locales/en.json (+1 -1)
📝 packages/server/src/routes/chats.routes.ts (+70 -52)
📝 packages/server/src/services/advanced-memory.ts (+65 -20)
📝 packages/server/src/services/storage/chats.storage.ts (+27 -3)
📝 packages/shared/src/types/advanced-memory.ts (+2 -0)
📝 scripts/regressions/advanced-memory-core.regression.ts (+174 -0)
➕ scripts/regressions/memory-recall-exclusivity.regression.ts (+218 -0)

📄 Description

Linked issue

Closes #7150
Closes #7151
Refs #7149
Refs #7154

Why this change

Basic Memory Recall and Advanced Memory could remain enabled together, and an enabled Advanced switch became unavailable during processing or a status failure. Changing modes could also leave Advanced work running or be undone by a delayed settings save. The resumable processing control was labelled Cancel, and its Resume action was easy to miss. Character persona pickers showed the generic Character label instead of titles, making same-name cards difficult to distinguish. The lorebook All view regrouped already-sorted books by category, breaking their global sort order.

What changed

  • Save mutually exclusive recall modes together, cancel the replaced Advanced operation, and merge delayed settings against the latest saved mode. Apply the optimistic mode choice to both UI caches and roll it back even when the save and status refresh both fail. Cancel replaced work only after the metadata write succeeds while its queue is still held; validate anchors after waiting for that queue. Keep the enabled Advanced switch usable during running/error states and allow disabling when a saved message or narrator no longer exists. Preserve transcript, prepared memories and other settings.
  • Label Advanced processing Pause processing, give Resume processing a matching full-width button, and retain the completed-work count while paused or interrupted. Use existing resume checkpoints and a persisted user-pause flag so new replies do not restart paused work. Keep ordinary interruption/correction recovery intact. Initial setup and Agent activity share these controls.
  • Reuse the existing trimmed character-title helper across setup, Chat Settings and desktop/mobile quick pickers, with localized Character fallback and truncation.
  • Show All lorebooks as one list in the selected sort order by removing the redundant category grouping. This is the sidebar change requested in #7154; character/persona assignment category rules are outside this change.
  • Add independent-client Echo reopening coverage for pinned and unpinned windows. The reported #7149 failure did not reproduce on unchanged staging in Chromium or Firefox, so this PR does not close or claim to fix that issue. Release preparation #7146/#7147 is untouched.

Validation

Completed local evidence:

  • pnpm install, pnpm check, pnpm regression:prompt, pnpm version:check, and diff checks passed. The full check includes localization, formatting, lint/type checks and the production build.
  • All 11 Advanced Memory Node regression files passed, including large-archive responsiveness. New recall-exclusivity, metadata-race, open-issue and floating-window regressions passed. Coverage includes competing saves, cancellation only after successful writes and before a held provider returns, failed-save preservation of active work, fresh validation after a queued anchor deletion, idempotent enables, legacy conflicts, stale-reference recovery and archive/transcript preservation. A persisted user pause survives a new reply and a fresh service, blocks tracker/post-generation work, preserves completed summaries and permits explicit resume. Ordinary correction recovery still passes.
  • Browser coverage across desktop Chromium, mobile Chromium and mobile WebKit: 9 final recovery/mode-switching cases, 3 setup/resume cases, 6 character-picker cases, and 2 independent-client Echo cases passed. Four duplicate Echo cases are intentionally skipped. Setup/resume covers retained progress after closing/reopening settings, pending-state duplicate-click prevention and light/dark themes. Final pnpm smoke:ui: 7 passed; pnpm smoke:production: 3 passed.
  • Lorebook sidebar QA: 6/6 browser/theme combinations passed (desktop Chromium, mobile Chromium, mobile WebKit × light/dark). Baseline All/A–Z reproduced A,C,B; fixed A–Z, token sorting, World filtering and return to All use the expected order.
  • Docker image marinara-engine:pr-7152 built and ran: health, production HTML, reciprocal recall-mode changes and fixture cleanup passed. Disposable container and volume removed.
  • Final local CodeRabbit review completed across 19 files, with one finding reviewed and rejected and no unresolved substantive findings. The claimed malformed regression structure is absent: the anchor-deletion case is inside the single main try/finally, declares its fixture before use, and runs successfully.

Human checklist remains unchecked:

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify the original Android/Termux chat from #7150. Its reported main build lacks staging's existing responsiveness fix daa5a3f60; current large-archive regressions pass, but the reporter's data and physical device were unavailable.
  • Manually verify #7149 in the affected Firefox profile. Unchanged code passed mobile-close to desktop-reopen in Chromium and Firefox 153/155, pinned/unpinned and legacy closed state. Firefox 153 also passed after new messages were added following the mobile close; Firefox 155 passed at 800/1024/1100px widths and all four corners. Sidebars were open where desktop navigation permits them. The affected Windows browser profile remains unavailable; its saved layout, zoom, theme/custom styling or another affected-layout detail may be needed to reproduce it. #7149 stays open.
  • Manually verify Pause/Resume during initial processing on a physical phone; completed checkpoints should remain visible and resume without restarting finished batches.
  • Manually verify duplicate-name character titles and blank-title fallback in persona pickers on physical devices. Automated browser emulation does not establish native-device behavior.

Docs and release impact

User-focused entries added to CHANGELOG. No user-facing docs changed, and no version bump is included.

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Before/after screenshot gallery · GitHub gist

Baseline picker cases fail on missing titles; baseline recovery controls fail because they are disabled. Both pass with the fix. Running/unavailable status UI cases use controlled status responses while toggles hit the real API; the held-provider cancellation proof separately exercises the server operation. The gallery also includes light-theme desktop/iPhone quick pickers and light/dark Pause/Resume controls. Echo evidence shows successful existing behavior, not a before/after fix.

Summary by CodeRabbit

  • New Features
    • Advanced Memory processing can now be paused and resumed, including during setup, while preserving completed work.
    • Switching between Memory Recall and Advanced Memory now enables one mode at a time. You can turn Advanced Memory off during processing or status errors without removing the chat or prepared memories.
    • Character pickers and Chat Settings display character titles or comments, with “Character” as a fallback label.
    • Lorebooks in the All view now appear in a single list, ordered by the selected sort option.
  • Bug Fixes
    • Memory mode selections remain consistent after saving or reloading, and disabling both modes preserves the chat transcript.

🔄 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/7152 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/open-issues-7149-7151` --- ### 📝 Commits (5) - [`ca4fb3c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ca4fb3c749af29943b7eea23d5cdbb0a4314bef6) chore: start fixes for Echo, memory recall and persona picker - [`c7aa6b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c7aa6b1285bc12c8a60689cc8caef9ac321b3ec2) Merge branch 'staging' into fix/open-issues-7149-7151 - [`f11b4e9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f11b4e9ae0ffb5cfa172bc6745b44ae2e4a2ccfc) fix: keep memory recall modes exclusive and show character titles - [`324596d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/324596d5162eb05494141c1599852621b50eb3c7) Merge remote-tracking branch 'origin/fix/open-issues-7149-7151' into fix/open-issues-7149-7151 - [`a291d8f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a291d8f8335619a88f4ac225bf7f022db878d0ff) fix: persist memory pause and keep All lorebooks sorted ### 📊 Changes **19 files changed** (+898 additions, -145 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+8 -0) 📝 `e2e/advanced-memory.e2e.ts` (+148 -11) 📝 `e2e/mobile-echo-window.e2e.ts` (+85 -0) 📝 `e2e/play-as-character-folder.e2e.ts` (+22 -4) 📝 `packages/client/src/components/chat/AdvancedMemoryProgress.tsx` (+9 -8) 📝 `packages/client/src/components/chat/AdvancedMemorySettings.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+11 -6) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+5 -3) 📝 `packages/client/src/components/chat/QuickPersonaSwitcher.tsx` (+4 -3) 📝 `packages/client/src/components/chat/QuickSwitcherMobile.tsx` (+4 -3) 📝 `packages/client/src/components/panels/LorebooksPanel.tsx` (+1 -29) 📝 `packages/client/src/hooks/use-chats.ts` (+43 -1) 📝 `packages/client/src/localization/locales/en.json` (+1 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+70 -52) 📝 `packages/server/src/services/advanced-memory.ts` (+65 -20) 📝 `packages/server/src/services/storage/chats.storage.ts` (+27 -3) 📝 `packages/shared/src/types/advanced-memory.ts` (+2 -0) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+174 -0) ➕ `scripts/regressions/memory-recall-exclusivity.regression.ts` (+218 -0) </details> ### 📄 Description ## Linked issue Closes #7150 Closes #7151 Refs #7149 Refs #7154 ## Why this change Basic Memory Recall and Advanced Memory could remain enabled together, and an enabled Advanced switch became unavailable during processing or a status failure. Changing modes could also leave Advanced work running or be undone by a delayed settings save. The resumable processing control was labelled Cancel, and its Resume action was easy to miss. Character persona pickers showed the generic Character label instead of titles, making same-name cards difficult to distinguish. The lorebook All view regrouped already-sorted books by category, breaking their global sort order. ## What changed - Save mutually exclusive recall modes together, cancel the replaced Advanced operation, and merge delayed settings against the latest saved mode. Apply the optimistic mode choice to both UI caches and roll it back even when the save and status refresh both fail. Cancel replaced work only after the metadata write succeeds while its queue is still held; validate anchors after waiting for that queue. Keep the enabled Advanced switch usable during running/error states and allow disabling when a saved message or narrator no longer exists. Preserve transcript, prepared memories and other settings. - Label Advanced processing **Pause processing**, give **Resume processing** a matching full-width button, and retain the completed-work count while paused or interrupted. Use existing resume checkpoints and a persisted user-pause flag so new replies do not restart paused work. Keep ordinary interruption/correction recovery intact. Initial setup and Agent activity share these controls. - Reuse the existing trimmed character-title helper across setup, Chat Settings and desktop/mobile quick pickers, with localized Character fallback and truncation. - Show **All** lorebooks as one list in the selected sort order by removing the redundant category grouping. This is the sidebar change requested in #7154; character/persona assignment category rules are outside this change. - Add independent-client Echo reopening coverage for pinned and unpinned windows. The reported #7149 failure did not reproduce on unchanged staging in Chromium or Firefox, so this PR does **not** close or claim to fix that issue. Release preparation #7146/#7147 is untouched. ## Validation Completed local evidence: - `pnpm install`, `pnpm check`, `pnpm regression:prompt`, `pnpm version:check`, and diff checks passed. The full check includes localization, formatting, lint/type checks and the production build. - All 11 Advanced Memory Node regression files passed, including large-archive responsiveness. New recall-exclusivity, metadata-race, open-issue and floating-window regressions passed. Coverage includes competing saves, cancellation only after successful writes and before a held provider returns, failed-save preservation of active work, fresh validation after a queued anchor deletion, idempotent enables, legacy conflicts, stale-reference recovery and archive/transcript preservation. A persisted user pause survives a new reply and a fresh service, blocks tracker/post-generation work, preserves completed summaries and permits explicit resume. Ordinary correction recovery still passes. - Browser coverage across desktop Chromium, mobile Chromium and mobile WebKit: **9 final recovery/mode-switching cases**, **3 setup/resume cases**, **6 character-picker cases**, and **2 independent-client Echo cases** passed. Four duplicate Echo cases are intentionally skipped. Setup/resume covers retained progress after closing/reopening settings, pending-state duplicate-click prevention and light/dark themes. Final `pnpm smoke:ui`: **7 passed**; `pnpm smoke:production`: **3 passed**. - Lorebook sidebar QA: **6/6 browser/theme combinations passed** (desktop Chromium, mobile Chromium, mobile WebKit × light/dark). Baseline All/A–Z reproduced A,C,B; fixed A–Z, token sorting, World filtering and return to All use the expected order. - Docker image `marinara-engine:pr-7152` built and ran: health, production HTML, reciprocal recall-mode changes and fixture cleanup passed. Disposable container and volume removed. - Final local CodeRabbit review completed across **19 files**, with one finding reviewed and rejected and no unresolved substantive findings. The claimed malformed regression structure is absent: the anchor-deletion case is inside the single main try/finally, declares its fixture before use, and runs successfully. Human checklist remains unchecked: - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify the original Android/Termux chat from #7150. Its reported main build lacks staging's existing responsiveness fix `daa5a3f60`; current large-archive regressions pass, but the reporter's data and physical device were unavailable. - Manually verify #7149 in the affected Firefox profile. Unchanged code passed mobile-close to desktop-reopen in Chromium and Firefox 153/155, pinned/unpinned and legacy closed state. Firefox 153 also passed after new messages were added following the mobile close; Firefox 155 passed at 800/1024/1100px widths and all four corners. Sidebars were open where desktop navigation permits them. The affected Windows browser profile remains unavailable; its saved layout, zoom, theme/custom styling or another affected-layout detail may be needed to reproduce it. #7149 stays open. - Manually verify Pause/Resume during initial processing on a physical phone; completed checkpoints should remain visible and resume without restarting finished batches. - Manually verify duplicate-name character titles and blank-title fallback in persona pickers on physical devices. Automated browser emulation does not establish native-device behavior. ## Docs and release impact User-focused entries added to CHANGELOG. No user-facing docs changed, and no version bump is included. - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) [Before/after screenshot gallery](https://gist.githack.com/SpicyMarinara/e587f74797b542dc945f8633bfda3b07/raw/94b0d7d493bb39cf0dc94ab1329263979da38dc7/gallery.html) · [GitHub gist](https://gist.github.com/SpicyMarinara/e587f74797b542dc945f8633bfda3b07) Baseline picker cases fail on missing titles; baseline recovery controls fail because they are disabled. Both pass with the fix. Running/unavailable status UI cases use controlled status responses while toggles hit the real API; the held-provider cancellation proof separately exercises the server operation. The gallery also includes light-theme desktop/iPhone quick pickers and light/dark Pause/Resume controls. Echo evidence shows successful existing behavior, not a before/after fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Advanced Memory processing can now be paused and resumed, including during setup, while preserving completed work. * Switching between Memory Recall and Advanced Memory now enables one mode at a time. You can turn Advanced Memory off during processing or status errors without removing the chat or prepared memories. * Character pickers and Chat Settings display character titles or comments, with “Character” as a fallback label. * Lorebooks in the **All** view now appear in a single list, ordered by the selected sort option. * **Bug Fixes** * Memory mode selections remain consistent after saving or reloading, and disabling both modes preserves the chat transcript. <!-- 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-23 04:20:26 +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#7503
No description provided.