[PR #6767] [MERGED] fix(memory): respect shared history cutoffs when swiping #7320

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

📋 Pull Request Information

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

Base: staging ← Head: codex/hidden-memory-start


📝 Commits (3)

  • 664b787 docs: track Advanced Memory swipe cutoff fix (#6766)
  • 318b082 fix(memory): keep shared history cutoffs during swipes (#6766)
  • e046776 Merge remote-tracking branch 'origin/staging' into codex/hidden-memory-start

📊 Changes

3 files changed (+101 additions, -12 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/advanced-memory.ts (+16 -12)
📝 scripts/regressions/advanced-memory-generation.regression.ts (+84 -0)

📄 Description

Linked issue

Closes #6766

Why this change

The first Roleplay reply honors Advanced Memory's shared "All" history cutoff, but its swipes can restore raw messages from before that cutoff. The reported marker is hidden from the responding character. An applicable cutoff must remain effective independently of that message's visibility.

What changed

Apply the shared cutoff to the source prefix used for regenerated replies. Previously, every historical request skipped the automatic cutoff, including a swipe of the newest reply. Reject cached swipe selections when their boundary precedes the current applicable shared cutoff. Boundaries after the regenerated reply remain outside its source prefix and do not rewrite its past.

Extend the existing generation regression to inspect the actual main-model request for fresh replies, saved swipes, rebuilt swipes, and moved cutoffs with character-hidden, globally hidden, and visible boundary messages.

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

Local validation on 318b08203:

  • pnpm check passed, including lint, types, localization, formatting and production build.
  • node scripts/run-regressions.mjs --filter scripts/regressions/advanced-memory passed all 11 suites.
  • pnpm regression:prompt passed.
  • node scripts/run-regressions.mjs --filter roleplay-regeneration-context passed.
  • Local CodeRabbit review completed with zero findings.
  • Negative controls: unchanged production code failed at rebuilt swipe history; the boundary-only fix then failed at stale snapshot reuse after moving the cutoff. Both pass with the complete fix.
  • Local Docker build passed; the isolated ARM64 container served a healthy API and the production HTML shell. Hosted checks remain pending on the final push.

Manually verify a fresh reply and multiple swipes in the affected chat, including the hidden shared-cutoff message. The regression uses isolated synthetic chats and a loopback provider; it does not exercise the maintainer's real chat or external model.

Docs and release impact

  • No docs changes needed
  • Updated docs and changelog as needed
  • Translated documentation updated or follow-up issue opened, if applicable
  • Version/release files updated, if applicable

Changelog updated. This restores the existing history-boundary behavior without changing UI labels, settings, documentation, versions, or storage format.

UI evidence

Prompt-selection behavior only; the regression checks the actual provider request, including preservation of hidden-message filtering and regeneration before a future cutoff. No UI changes.

Summary by CodeRabbit

  • Bug Fixes
    • Advanced Memory generation and swipe regeneration now consistently respect the shared “All” history cutoff, even when its message is hidden from the responding character.
    • Replies continue to include the current input while excluding history before the cutoff. Later cutoffs no longer affect earlier replies, and swipe selections are refreshed when a newer cutoff changes the applicable history boundary.

🔄 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/6767 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/hidden-memory-start` --- ### 📝 Commits (3) - [`664b787`](https://github.com/Pasta-Devs/Marinara-Engine/commit/664b787f41bc5edb7f6ba9b223074b77b263b310) docs: track Advanced Memory swipe cutoff fix (#6766) - [`318b082`](https://github.com/Pasta-Devs/Marinara-Engine/commit/318b082032abc6f9b2559d48b154f66b61da81e5) fix(memory): keep shared history cutoffs during swipes (#6766) - [`e046776`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e046776558688df79d0bbd7df3c5a2d26bce7f24) Merge remote-tracking branch 'origin/staging' into codex/hidden-memory-start ### 📊 Changes **3 files changed** (+101 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/advanced-memory.ts` (+16 -12) 📝 `scripts/regressions/advanced-memory-generation.regression.ts` (+84 -0) </details> ### 📄 Description ## Linked issue Closes #6766 ## Why this change The first Roleplay reply honors Advanced Memory's shared "All" history cutoff, but its swipes can restore raw messages from before that cutoff. The reported marker is hidden from the responding character. An applicable cutoff must remain effective independently of that message's visibility. ## What changed Apply the shared cutoff to the source prefix used for regenerated replies. Previously, every historical request skipped the automatic cutoff, including a swipe of the newest reply. Reject cached swipe selections when their boundary precedes the current applicable shared cutoff. Boundaries after the regenerated reply remain outside its source prefix and do not rewrite its past. Extend the existing generation regression to inspect the actual main-model request for fresh replies, saved swipes, rebuilt swipes, and moved cutoffs with character-hidden, globally hidden, and visible boundary messages. ## 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` Local validation on `318b08203`: - `pnpm check` passed, including lint, types, localization, formatting and production build. - `node scripts/run-regressions.mjs --filter scripts/regressions/advanced-memory` passed all 11 suites. - `pnpm regression:prompt` passed. - `node scripts/run-regressions.mjs --filter roleplay-regeneration-context` passed. - Local CodeRabbit review completed with zero findings. - Negative controls: unchanged production code failed at rebuilt swipe history; the boundary-only fix then failed at stale snapshot reuse after moving the cutoff. Both pass with the complete fix. - Local Docker build passed; the isolated ARM64 container served a healthy API and the production HTML shell. Hosted checks remain pending on the final push. Manually verify a fresh reply and multiple swipes in the affected chat, including the hidden shared-cutoff message. The regression uses isolated synthetic chats and a loopback provider; it does not exercise the maintainer's real chat or external model. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs and changelog as needed - [ ] Translated documentation updated or follow-up issue opened, if applicable - [ ] Version/release files updated, if applicable Changelog updated. This restores the existing history-boundary behavior without changing UI labels, settings, documentation, versions, or storage format. ## UI evidence Prompt-selection behavior only; the regression checks the actual provider request, including preservation of hidden-message filtering and regeneration before a future cutoff. No UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Advanced Memory generation and swipe regeneration now consistently respect the shared “All” history cutoff, even when its message is hidden from the responding character. * Replies continue to include the current input while excluding history before the cutoff. Later cutoffs no longer affect earlier replies, and swipe selections are refreshed when a newer cutoff changes the applicable history boundary. <!-- 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:18:36 +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#7320
No description provided.