[PR #6494] [MERGED] fix: preserve saved prompts and character-scoped memory summaries #7201

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6494
Author: @SpicyMarinara
Created: 9/21/2026
Status: ✅ Merged
Merged: 9/21/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/sept21-peek-prompt-character


📝 Commits (3)

  • 370ed1b docs: track message-bound prompt inspection fix
  • 5b1c2ea fix: preserve saved message prompts and summary-owned hidden constants
  • 18033f5 fix: honor character conditions in advanced memory constants

📊 Changes

10 files changed (+452 additions, -159 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 e2e/advanced-memory.e2e.ts (+83 -0)
📝 e2e/core-flows.e2e.ts (+5 -0)
📝 packages/client/src/components/chat/ChatConversationSurface.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+6 -4)
📝 packages/client/src/components/chat/ConversationView.tsx (+4 -4)
📝 packages/server/src/routes/chats.routes.ts (+3 -7)
📝 packages/server/src/services/advanced-memory.ts (+144 -111)
📝 scripts/regressions/advanced-memory-generation.regression.ts (+106 -2)
📝 scripts/regressions/advanced-memory-post-generation.regression.ts (+96 -30)

📄 Description

Linked issue

Closes #6493. Closes #6495. Implementation owner: SpicyMarinara / Codex.

Why this change

Reopening Peek Prompt from Maukie's reply after an Illustrator image or summary update could show a newly assembled request for the narrator instead. Advanced Memory also omitted enabled Chat Summaries based on access to their original message ranges, even when the summaries explicitly contained a section for Maukie. On mobile, a second tap on Author's Notes reopened the panel immediately after closing it.

What changed

  • Bind Roleplay and Conversation message actions to the selected reply and active swipe. Inspect the saved request independently of later image, summary or memory changes. A missing saved request returns the existing unavailable response; it does not substitute another swipe or a new preview.
  • Use enabled Chat Summaries and their authored {{#if …}} conditions for character visibility. Raw hidden messages and recalled archives retain their access checks; historical generation still excludes future summary ranges.
  • Add the same editable character conditions to Advanced Memory's new and compacted constants. Reuse existing covered ranges separately for each character, include the narrator in automatic scene constants, and preserve entries containing different Maukie/Pantalone sections during compaction. Continue using Chat Summaries and its Maximum output size after generation.
  • Let the visible Author's Notes button toggle the shared panel without a hidden desktop copy treating the tap as an outside click.

No archive reset, migration, new dependency or separate summary mechanism is needed.

Validation

  • 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

Automated evidence (checkboxes remain human verification tasks):

  • pnpm check and pnpm regression:prompt passed. The check includes localization, formatting, lint, types and production builds; one pre-existing GameNarration hook warning remains.
  • All eight Advanced Memory regression suites passed, including actual provider-request capture, the reported conditional, per-character range reuse, conditional compaction, hidden raw sources, personal start flags and historical/swipe isolation.
  • The saved-message Peek Prompt and Author's Notes toggle tests passed on desktop Chromium, mobile Chromium and mobile WebKit. The unrelated combat-board case that failed in the first CI run also passed locally on all three browsers.
  • Focused shell smoke tests passed: 18 passed, 6 desktop skips for mobile-only cases.
  • The ARM64 Docker image built and passed disposable-container API, frontend, native-binding, non-root and persistent-data write/restart/read checks.
  • Local CodeRabbit identified a message-index lookup problem when saving multiple character-specific additions from one scene. A new regression reproduced it before the ID-based fix and passed afterwards.

Proof boundary

Core claims are stable inspection of the actual saved request, authored character conditions controlling constants, and a working mobile panel toggle. Prompt assembly and historical inspection are the risk boundaries. Tests cover ranged and legacy constants, distinct sections within one summary, new and compacted constants, late image/metadata updates, active and missing swipe caches, and future-range exclusion. Raw source visibility remains separate from constant visibility. The original chat, physical iPhone and live provider output have not been tested.

Manual verification notes

Manually verify Maukie's original chat on iPhone: generate with the enabled conditional summaries, inspect that reply, wait for Illustrator, and inspect it again. Confirm the saved character, commands and constants do not change. Verify Maukie and Pantalone receive their respective sections, and newly generated constants have editable character conditions in Chat Summaries. Tap Author's Notes twice to open and close it. Local verification used isolated fixture chats and databases.

Docs and release impact

  • 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)

Three Unreleased changelog entries; no user-facing documentation, version metadata or localized copy changed.

UI evidence (if applicable)

Existing message actions, prompt modal and Author's Notes panel are reused. Browser tests capture light/dark screenshots for saved-prompt inspection in both modes on all three projects. Desktop light and mobile WebKit dark Roleplay screenshots were visually inspected. Failing-then-passing behavioral tests cover the missing constants and mobile Author's Notes toggle.

Summary by CodeRabbit

  • Bug Fixes
    • Author’s Notes now reliably closes and reopens when toggled in the mobile roleplay toolbar.
    • Message Peek Prompt remains associated with the selected reply or swipe after images, summaries, or memory settings change.
    • Historical cached prompts are preserved and no longer replaced by another swipe’s prompt.
    • Advanced Memory now retains enabled summaries and character-specific conditions when source messages are hidden or precede a character’s start point, while maintaining privacy restrictions on recalled scenes and raw messages.

🔄 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/6494 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/21/2026 **Status:** ✅ Merged **Merged:** 9/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/sept21-peek-prompt-character` --- ### 📝 Commits (3) - [`370ed1b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/370ed1bfca192e2f24529db77cbe38eec3492e42) docs: track message-bound prompt inspection fix - [`5b1c2ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b1c2ead52fa8d41aa519ff615826717898aa531) fix: preserve saved message prompts and summary-owned hidden constants - [`18033f5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/18033f5df145ea230258447f51f4412b74ab3ec9) fix: honor character conditions in advanced memory constants ### 📊 Changes **10 files changed** (+452 additions, -159 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `e2e/advanced-memory.e2e.ts` (+83 -0) 📝 `e2e/core-flows.e2e.ts` (+5 -0) 📝 `packages/client/src/components/chat/ChatConversationSurface.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+6 -4) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+4 -4) 📝 `packages/server/src/routes/chats.routes.ts` (+3 -7) 📝 `packages/server/src/services/advanced-memory.ts` (+144 -111) 📝 `scripts/regressions/advanced-memory-generation.regression.ts` (+106 -2) 📝 `scripts/regressions/advanced-memory-post-generation.regression.ts` (+96 -30) </details> ### 📄 Description ## Linked issue Closes #6493. Closes #6495. Implementation owner: SpicyMarinara / Codex. ## Why this change Reopening Peek Prompt from Maukie's reply after an Illustrator image or summary update could show a newly assembled request for the narrator instead. Advanced Memory also omitted enabled Chat Summaries based on access to their original message ranges, even when the summaries explicitly contained a section for Maukie. On mobile, a second tap on Author's Notes reopened the panel immediately after closing it. ## What changed - Bind Roleplay and Conversation message actions to the selected reply and active swipe. Inspect the saved request independently of later image, summary or memory changes. A missing saved request returns the existing unavailable response; it does not substitute another swipe or a new preview. - Use enabled Chat Summaries and their authored `{{#if …}}` conditions for character visibility. Raw hidden messages and recalled archives retain their access checks; historical generation still excludes future summary ranges. - Add the same editable character conditions to Advanced Memory's new and compacted constants. Reuse existing covered ranges separately for each character, include the narrator in automatic scene constants, and preserve entries containing different Maukie/Pantalone sections during compaction. Continue using Chat Summaries and its Maximum output size after generation. - Let the visible Author's Notes button toggle the shared panel without a hidden desktop copy treating the tap as an outside click. No archive reset, migration, new dependency or separate summary mechanism is needed. ## Validation - [ ] `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` Automated evidence (checkboxes remain human verification tasks): - `pnpm check` and `pnpm regression:prompt` passed. The check includes localization, formatting, lint, types and production builds; one pre-existing GameNarration hook warning remains. - All eight Advanced Memory regression suites passed, including actual provider-request capture, the reported conditional, per-character range reuse, conditional compaction, hidden raw sources, personal start flags and historical/swipe isolation. - The saved-message Peek Prompt and Author's Notes toggle tests passed on desktop Chromium, mobile Chromium and mobile WebKit. The unrelated combat-board case that failed in the first CI run also passed locally on all three browsers. - Focused shell smoke tests passed: 18 passed, 6 desktop skips for mobile-only cases. - The ARM64 Docker image built and passed disposable-container API, frontend, native-binding, non-root and persistent-data write/restart/read checks. - Local CodeRabbit identified a message-index lookup problem when saving multiple character-specific additions from one scene. A new regression reproduced it before the ID-based fix and passed afterwards. ### Proof boundary Core claims are stable inspection of the actual saved request, authored character conditions controlling constants, and a working mobile panel toggle. Prompt assembly and historical inspection are the risk boundaries. Tests cover ranged and legacy constants, distinct sections within one summary, new and compacted constants, late image/metadata updates, active and missing swipe caches, and future-range exclusion. Raw source visibility remains separate from constant visibility. The original chat, physical iPhone and live provider output have not been tested. ### Manual verification notes Manually verify Maukie's original chat on iPhone: generate with the enabled conditional summaries, inspect that reply, wait for Illustrator, and inspect it again. Confirm the saved character, commands and constants do not change. Verify Maukie and Pantalone receive their respective sections, and newly generated constants have editable character conditions in Chat Summaries. Tap Author's Notes twice to open and close it. Local verification used isolated fixture chats and databases. ## Docs and release impact - [ ] 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) Three Unreleased changelog entries; no user-facing documentation, version metadata or localized copy changed. ## UI evidence (if applicable) Existing message actions, prompt modal and Author's Notes panel are reused. Browser tests capture light/dark screenshots for saved-prompt inspection in both modes on all three projects. Desktop light and mobile WebKit dark Roleplay screenshots were visually inspected. Failing-then-passing behavioral tests cover the missing constants and mobile Author's Notes toggle. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Author’s Notes now reliably closes and reopens when toggled in the mobile roleplay toolbar. - Message Peek Prompt remains associated with the selected reply or swipe after images, summaries, or memory settings change. - Historical cached prompts are preserved and no longer replaced by another swipe’s prompt. - Advanced Memory now retains enabled summaries and character-specific conditions when source messages are hidden or precede a character’s start point, while maintaining privacy restrictions on recalled scenes and raw messages. <!-- 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:17:29 +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#7201
No description provided.