[PR #6451] [MERGED] fix: prepare full memory history and share equivalent scene summaries #7181

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept20-advanced-memory-recall-fixes


📝 Commits (4)

  • 2aa008d chore: start focused advanced memory regression fixes
  • 2eb8960 fix: backfill roleplay history and share equivalent scene memories
  • 5e3b0df test: cover shared memory controls and default system placement
  • 1382d3f fix: let the narrator reuse shared scene memories

📊 Changes

9 files changed (+446 additions, -64 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/advanced-memory.e2e.ts (+54 -6)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+22 -9)
📝 packages/client/src/localization/locales/en.json (+3 -3)
📝 packages/server/src/services/advanced-memory.ts (+128 -41)
📝 scripts/regressions/advanced-memory-core.regression.ts (+54 -2)
📝 scripts/regressions/advanced-memory-post-generation.regression.ts (+3 -3)
📝 scripts/regressions/advanced-memory-summary.regression.ts (+158 -0)
📝 scripts/regressions/prompt.regression.ts (+22 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

Addresses #6450. The original iPhone-app spacing symptom still needs confirmation on the reporter's device.

Why this change

Automatic Advanced Memory preparation skipped historical scene detection, while later tracker checks only inspected recent messages. Character audiences with identical eligible history also received independently generated scene copies, making the archive look duplicated and increasing generation costs.

What changed

  • Initial automatic preparation classifies the full eligible history, including older scenes behind a recent-only checkpoint. Interrupted classification resumes from its saved checkpoint; background refresh alone cannot mark historical classification complete.
  • Characters with identical scene sources, corrections and macro values share one scene record. Identical summary inputs reuse one generated response, including the internal owner archive. Superseded generated records are removed only after replacements are complete; manual edits and explicit exclusions remain.
  • The selected narrator reads the shared scene archive across character participation boundaries, without generating narrator-specific scene copies. Explicit narrator hiding, narrator macro identity, and the existing persona-impersonation scope remain intact.
  • The inspector displays the character summary once, with its audience names, instead of also displaying its redundant owner copy. Rows use explicit block/flex layout and bounded preview text.
  • Advanced Memory's summary instruction asks for self-contained historical recaps, without current-situation, open-tension or next-step sections. Existing manual text is untouched.
  • Prompt placement is unchanged. Regression coverage confirms that the default role formatting merges automatic memory blocks into the system prompt before history when memory markers are absent.

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

Executed by Codex (checkboxes deliberately remain for a human):

  • pnpm check passed, including localization, types, lint and production builds.
  • Five Advanced Memory regression files passed. New proofs cover shared generation, legacy generated-copy cleanup, manual corrections, hidden history, and cancelled multi-window historical classification behind a recent checkpoint. Narrator coverage verifies reuse of an early shared scene, no separate narrator scene records, narrator macro resolution, explicit hiding, and unchanged owner-impersonation visibility.
  • chat-branch-lineage.regression.ts passed for memory branch/import behavior.
  • pnpm regression:prompt passed; default system placement is explicitly verified in XML, Markdown and plain formats.
  • All 12 scenarios across the memory settings/wizard browser suites passed on desktop Chromium, mobile Chromium and mobile WebKit. The three extended archive cases were rerun after correcting the long-list fixture's count expectation. Checks cover light/dark themes, 12 long scene cards, non-overlapping spacing, shared audience labels, search, edit/disable, reindex and reset/cancel controls.
  • Local CodeRabbit completed. Test-proof findings and narrator identity/owner-scope findings were addressed and covered by regression checks. The hosted suggestion to swallow cleanup failures was discussed and withdrawn: readiness must wait until superseded records are actually removed.
  • Local full-source Docker build hit host disk exhaustion. After clearing disposable test caches, a runtime image using the new compiled artifacts and the existing production image with identical dependency manifests built and returned a healthy /api/health response. GitHub's full Docker build remains a merge gate.

Manual verification notes

  • Manually verify the original large blank gaps in the actual iPhone app after updating. Browser WebKit did not reproduce the original native-app gap; its compact-layout and scroll checks pass. This is a proof limitation, not a claim of physical-device validation.
  • Manually verify the preferred recap style with the selected live model. Automated tests verify the outgoing instruction, not a live model's prose quality.
  • No private chat messages or original screenshot were uploaded. No existing user database was reset or rewritten during testing.

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)

CHANGELOG and canonical English memory help were updated. No documentation under docs/, dependency, version or downloadable-agent changes.

UI evidence

Synthetic light/dark archive screenshots cover desktop Chromium, mobile Chromium and mobile WebKit. Download an HTML file and open it locally to view the embedded, unmodified browser captures. The original before screenshot contains private chat content and is not republished.

Summary by CodeRabbit

  • New Features

    • Advanced Memory now prepares the full eligible Roleplay history before replies.
    • Unfinished scenes can resume automatically, including across longer histories.
    • Characters sharing a history reuse scene summaries, with more efficient archive handling.
    • Historical recaps now focus on past events and omit current situation and open tensions.
  • Bug Fixes

    • Improved scene detection and classification across segmented conversations.
    • Reduced duplicate scene entries and improved visibility handling for shared scenes.
  • Documentation

    • Updated Advanced Memory guidance to reflect automatic preparation and revised recap behavior.

🔄 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/6451 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/20/2026 **Status:** ✅ Merged **Merged:** 9/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/sept20-advanced-memory-recall-fixes` --- ### 📝 Commits (4) - [`2aa008d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2aa008d5eb470f81e10884352951fe2bf015bf3b) chore: start focused advanced memory regression fixes - [`2eb8960`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2eb8960d5d8d395f2d6c4a35f9d95f980d800256) fix: backfill roleplay history and share equivalent scene memories - [`5e3b0df`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5e3b0dff471a17089f231a5e29ce1b4eb4379b06) test: cover shared memory controls and default system placement - [`1382d3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1382d3fa7735019f9003352c5cccaed8c21bf76e) fix: let the narrator reuse shared scene memories ### 📊 Changes **9 files changed** (+446 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/advanced-memory.e2e.ts` (+54 -6) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+22 -9) 📝 `packages/client/src/localization/locales/en.json` (+3 -3) 📝 `packages/server/src/services/advanced-memory.ts` (+128 -41) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+54 -2) 📝 `scripts/regressions/advanced-memory-post-generation.regression.ts` (+3 -3) 📝 `scripts/regressions/advanced-memory-summary.regression.ts` (+158 -0) 📝 `scripts/regressions/prompt.regression.ts` (+22 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue Addresses #6450. The original iPhone-app spacing symptom still needs confirmation on the reporter's device. ## Why this change Automatic Advanced Memory preparation skipped historical scene detection, while later tracker checks only inspected recent messages. Character audiences with identical eligible history also received independently generated scene copies, making the archive look duplicated and increasing generation costs. ## What changed - Initial automatic preparation classifies the full eligible history, including older scenes behind a recent-only checkpoint. Interrupted classification resumes from its saved checkpoint; background refresh alone cannot mark historical classification complete. - Characters with identical scene sources, corrections and macro values share one scene record. Identical summary inputs reuse one generated response, including the internal owner archive. Superseded generated records are removed only after replacements are complete; manual edits and explicit exclusions remain. - The selected narrator reads the shared scene archive across character participation boundaries, without generating narrator-specific scene copies. Explicit narrator hiding, narrator macro identity, and the existing persona-impersonation scope remain intact. - The inspector displays the character summary once, with its audience names, instead of also displaying its redundant owner copy. Rows use explicit block/flex layout and bounded preview text. - Advanced Memory's summary instruction asks for self-contained historical recaps, without current-situation, open-tension or next-step sections. Existing manual text is untouched. - Prompt placement is unchanged. Regression coverage confirms that the default role formatting merges automatic memory blocks into the system prompt before history when memory markers are absent. ## 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` Executed by Codex (checkboxes deliberately remain for a human): - `pnpm check` passed, including localization, types, lint and production builds. - Five Advanced Memory regression files passed. New proofs cover shared generation, legacy generated-copy cleanup, manual corrections, hidden history, and cancelled multi-window historical classification behind a recent checkpoint. Narrator coverage verifies reuse of an early shared scene, no separate narrator scene records, narrator macro resolution, explicit hiding, and unchanged owner-impersonation visibility. - `chat-branch-lineage.regression.ts` passed for memory branch/import behavior. - `pnpm regression:prompt` passed; default system placement is explicitly verified in XML, Markdown and plain formats. - All 12 scenarios across the memory settings/wizard browser suites passed on desktop Chromium, mobile Chromium and mobile WebKit. The three extended archive cases were rerun after correcting the long-list fixture's count expectation. Checks cover light/dark themes, 12 long scene cards, non-overlapping spacing, shared audience labels, search, edit/disable, reindex and reset/cancel controls. - Local CodeRabbit completed. Test-proof findings and narrator identity/owner-scope findings were addressed and covered by regression checks. The hosted suggestion to swallow cleanup failures was discussed and withdrawn: readiness must wait until superseded records are actually removed. - Local full-source Docker build hit host disk exhaustion. After clearing disposable test caches, a runtime image using the new compiled artifacts and the existing production image with identical dependency manifests built and returned a healthy `/api/health` response. GitHub's full Docker build remains a merge gate. ### Manual verification notes - Manually verify the original large blank gaps in the actual iPhone app after updating. Browser WebKit did not reproduce the original native-app gap; its compact-layout and scroll checks pass. This is a proof limitation, not a claim of physical-device validation. - Manually verify the preferred recap style with the selected live model. Automated tests verify the outgoing instruction, not a live model's prose quality. - No private chat messages or original screenshot were uploaded. No existing user database was reset or rewritten during testing. ## 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) CHANGELOG and canonical English memory help were updated. No documentation under `docs/`, dependency, version or downloadable-agent changes. ## UI evidence [Synthetic light/dark archive screenshots](https://gist.github.com/SpicyMarinara/0c391941cb81a9e7af9be519081b0362) cover desktop Chromium, mobile Chromium and mobile WebKit. Download an HTML file and open it locally to view the embedded, unmodified browser captures. The original before screenshot contains private chat content and is not republished. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Advanced Memory now prepares the full eligible Roleplay history before replies. - Unfinished scenes can resume automatically, including across longer histories. - Characters sharing a history reuse scene summaries, with more efficient archive handling. - Historical recaps now focus on past events and omit current situation and open tensions. - **Bug Fixes** - Improved scene detection and classification across segmented conversations. - Reduced duplicate scene entries and improved visibility handling for shared scenes. - **Documentation** - Updated Advanced Memory guidance to reflect automatic preparation and revised recap behavior. <!-- 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:18 +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#7181
No description provided.