[PR #6459] [MERGED] fix: retain earlier memories and show automatic context cutoffs #7187

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept20-memory-full-history


📝 Commits (2)

  • b867049 chore: coordinate memory history cutoff fix
  • 370dcdf fix: preserve early memories and show automatic context cutoffs

📊 Changes

10 files changed (+414 additions, -12 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/advanced-memory.e2e.ts (+55 -5)
📝 packages/client/src/components/chat/ChatMessage.tsx (+13 -2)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+20 -0)
📝 packages/client/src/hooks/use-generate.ts (+1 -0)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/services/advanced-memory.ts (+30 -5)
📝 packages/shared/src/types/advanced-memory.ts (+2 -0)
📝 scripts/regressions/advanced-memory-generation.regression.ts (+28 -0)
➕ scripts/regressions/advanced-memory-history-start.regression.ts (+262 -0)

📄 Description

Linked issue

Closes #6450

Why this change

In an ongoing chat, a shared “Mark as new start” marker was excluding older messages from Advanced Memory preparation and recall. Resetting and preparing again therefore still missed most of a long chat. Automatic memory cutoffs were also invisible in the conversation.

What changed

  • Archive preparation includes history before shared start markers. Those markers still shorten the raw live context. Character-specific manual starts, confirmed knowledge ranges, and hidden-message restrictions remain authoritative.
  • Automatic cutoffs reuse the existing visible start markers, including individual audiences and compression within long scenes. Their metadata stays separate from manual knowledge flags so moving a cutoff never makes earlier eligible memories inaccessible.
  • Preview and historical regeneration do not move the current visible cutoff. Reset clears it. Existing summaries are reused, and the new policy invalidates old prepared prompts without requiring users to reset their archive.

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

Passed locally: pnpm check (including localization), pnpm regression:prompt, and all six Advanced Memory Node regressions. A 1,000-message fixture reproduces the original failure and now proves preparation of early scenes, recall in the system prompt, shared raw-context trimming, individual knowledge boundaries, hidden-message exclusion, narrator sharing, cutoff movement, summary reuse, and reset behavior.

The real generation route also verifies automatic audience cutoffs and older summaries with a shared start marker. Twelve existing browser cases passed across desktop Chromium, mobile Chromium, and iPhone WebKit; the three new marker cases pass after correcting an exact-label expectation in the test. Both themes, shared/individual labels, movement, disable, and reset were exercised. Provider replies are deterministic fixtures.

A local runtime container built from compiled artifacts on the existing identical-dependency production base returned a healthy /api/health. The required GitHub container check performs the full source build.

Manual verification notes

Synthetic screenshots were visually inspected. Human checklist items remain unchecked. Manually verify with a live provider and the installed iPhone app; browser emulation does not establish physical-device or model-summary quality.

Docs and release impact

Added one canonical English tooltip and an Unreleased changelog entry. No dependency, version, or translated-document changes. Users can run Prepare existing history once to fill missing older scenes without deleting their archive or manual flags.

UI evidence

Before/after screenshot sheets show synthetic fixtures only. No private chat content or user screenshots were uploaded.


🔄 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/6459 **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-memory-full-history` --- ### 📝 Commits (2) - [`b867049`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b8670498aae5ef67d1311822c9463464d530032c) chore: coordinate memory history cutoff fix - [`370dcdf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/370dcdf664f8c8d3dd7baf3a0e1308a4222dfcb7) fix: preserve early memories and show automatic context cutoffs ### 📊 Changes **10 files changed** (+414 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/advanced-memory.e2e.ts` (+55 -5) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+13 -2) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+20 -0) 📝 `packages/client/src/hooks/use-generate.ts` (+1 -0) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/services/advanced-memory.ts` (+30 -5) 📝 `packages/shared/src/types/advanced-memory.ts` (+2 -0) 📝 `scripts/regressions/advanced-memory-generation.regression.ts` (+28 -0) ➕ `scripts/regressions/advanced-memory-history-start.regression.ts` (+262 -0) </details> ### 📄 Description ## Linked issue Closes #6450 ## Why this change In an ongoing chat, a shared “Mark as new start” marker was excluding older messages from Advanced Memory preparation and recall. Resetting and preparing again therefore still missed most of a long chat. Automatic memory cutoffs were also invisible in the conversation. ## What changed - Archive preparation includes history before shared start markers. Those markers still shorten the raw live context. Character-specific manual starts, confirmed knowledge ranges, and hidden-message restrictions remain authoritative. - Automatic cutoffs reuse the existing visible start markers, including individual audiences and compression within long scenes. Their metadata stays separate from manual knowledge flags so moving a cutoff never makes earlier eligible memories inaccessible. - Preview and historical regeneration do not move the current visible cutoff. Reset clears it. Existing summaries are reused, and the new policy invalidates old prepared prompts without requiring users to reset their archive. ## 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` Passed locally: `pnpm check` (including localization), `pnpm regression:prompt`, and all six Advanced Memory Node regressions. A 1,000-message fixture reproduces the original failure and now proves preparation of early scenes, recall in the system prompt, shared raw-context trimming, individual knowledge boundaries, hidden-message exclusion, narrator sharing, cutoff movement, summary reuse, and reset behavior. The real generation route also verifies automatic audience cutoffs and older summaries with a shared start marker. Twelve existing browser cases passed across desktop Chromium, mobile Chromium, and iPhone WebKit; the three new marker cases pass after correcting an exact-label expectation in the test. Both themes, shared/individual labels, movement, disable, and reset were exercised. Provider replies are deterministic fixtures. A local runtime container built from compiled artifacts on the existing identical-dependency production base returned a healthy `/api/health`. The required GitHub container check performs the full source build. ### Manual verification notes Synthetic screenshots were visually inspected. Human checklist items remain unchecked. Manually verify with a live provider and the installed iPhone app; browser emulation does not establish physical-device or model-summary quality. ## Docs and release impact Added one canonical English tooltip and an Unreleased changelog entry. No dependency, version, or translated-document changes. Users can run Prepare existing history once to fill missing older scenes without deleting their archive or manual flags. ## UI evidence [Before/after screenshot sheets](https://gist.github.com/SpicyMarinara/cb8b28f86a9ab4f691a176e6456f61fb) show synthetic fixtures only. No private chat content or user screenshots were uploaded. --- <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:21 +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#7187
No description provided.