[PR #6469] [MERGED] fix: exclude Advanced Memory already present in live context #7191

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept20-memory-context-overlap


📝 Commits (3)

  • 8110f9a chore: coordinate Advanced Memory overlap fix (#6468)
  • 64b6ec6 fix: exclude Advanced Memory already in live context (#6468)
  • 7be28ee fix: exclude live scene timeframes from recalled excerpts

📊 Changes

6 files changed (+128 additions, -37 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/agents/memory.md (+1 -1)
📝 packages/server/src/services/advanced-memory.ts (+11 -23)
📝 scripts/regressions/advanced-memory-core.regression.ts (+9 -8)
📝 scripts/regressions/advanced-memory-history-start.regression.ts (+100 -1)
📝 scripts/regressions/advanced-memory-summary.regression.ts (+5 -4)

📄 Description

Linked issue

Closes #6468

Why this change

A context cutoff inside a scene could recall its entire recap alongside the scene's remaining live messages. Ranged manual summaries could also pull live messages into continuity. This wastes context and repeats information the model already receives.

What changed

  • Recall a scene recap only when every source message is outside live history. Exact-message recall still selects only non-live messages from eligible excerpt chunks and cannot borrow timeframe labels from an overlapping scene.
  • Limit continuity and its manual-summary corrections to the archived prefix; omit continuity when no messages have left live history.
  • Invalidate old prepared-prompt receipts without resetting the saved scene archive or regenerating completed scene summaries.
  • Document the range rules and extend the existing memory regressions. Translation follow-up: #6467.

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 (human checklist left unchecked):

  • Reproduced the partial-scene overlap, then separately reproduced overlapping ranged corrections entering continuity, before their respective fixes.
  • All six Advanced Memory regression suites pass, covering full and partial live ranges, older positive controls, exact excerpts and timeframe labels, character/narrator visibility, cached previews, completed recap preservation, resume, and transfer dependencies.
  • pnpm check passes, including localization, formatting, lint/types and production builds.
  • pnpm regression:prompt passes all three prompt, attachment and context-fit lanes.
  • Local CodeRabbit reviews of the initial patch and final adjustment completed with zero findings. The GitHub review identified one valid timeframe fallback issue; it was reproduced and fixed with regression coverage.
  • GitHub's final CodeRabbit recheck reports no actionable comments. Its optional docstring-coverage warning is left as-is: this focused filtering change keeps the existing internal function contracts, with the boundary rules covered by the guide and regressions.
  • A local runtime container using the freshly built workspace artifacts started successfully and returned HTTP 200 from /api/health. The full dependency/container rebuild is also exercised by required GitHub CI.

Manual verification notes

Manually verify the final prompt inspector with a shared context start inside a scene and existing ranged manual summaries: live messages should have no overlapping full recap, while older memories remain available. No interactive browser session was performed for this server-only change. Actual generation, dry-run preview and historical regeneration are exercised by the API regression.

Docs and release impact

  • No docs changes needed
  • Updated docs and CHANGELOG as needed
  • Translated docs updated or a follow-up issue opened
  • Version/release files updated

Updated docs/agents/memory.md and CHANGELOG.md; #6467 includes the translation follow-up. No release metadata, storage-format or dependency changes.

UI evidence (if applicable)

No interface changes.


🔄 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/6469 **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-context-overlap` --- ### 📝 Commits (3) - [`8110f9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8110f9a9204a2b75c6f356b7d2bd5e16f4d1f261) chore: coordinate Advanced Memory overlap fix (#6468) - [`64b6ec6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/64b6ec6d52baa87614702d2411043629fd4518a7) fix: exclude Advanced Memory already in live context (#6468) - [`7be28ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7be28eee4e2bb00788bfac9db08bdf6c590ccaac) fix: exclude live scene timeframes from recalled excerpts ### 📊 Changes **6 files changed** (+128 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/agents/memory.md` (+1 -1) 📝 `packages/server/src/services/advanced-memory.ts` (+11 -23) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+9 -8) 📝 `scripts/regressions/advanced-memory-history-start.regression.ts` (+100 -1) 📝 `scripts/regressions/advanced-memory-summary.regression.ts` (+5 -4) </details> ### 📄 Description ## Linked issue Closes #6468 ## Why this change A context cutoff inside a scene could recall its entire recap alongside the scene's remaining live messages. Ranged manual summaries could also pull live messages into continuity. This wastes context and repeats information the model already receives. ## What changed - Recall a scene recap only when every source message is outside live history. Exact-message recall still selects only non-live messages from eligible excerpt chunks and cannot borrow timeframe labels from an overlapping scene. - Limit continuity and its manual-summary corrections to the archived prefix; omit continuity when no messages have left live history. - Invalidate old prepared-prompt receipts without resetting the saved scene archive or regenerating completed scene summaries. - Document the range rules and extend the existing memory regressions. Translation follow-up: #6467. ## 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 (human checklist left unchecked): - Reproduced the partial-scene overlap, then separately reproduced overlapping ranged corrections entering continuity, before their respective fixes. - All six Advanced Memory regression suites pass, covering full and partial live ranges, older positive controls, exact excerpts and timeframe labels, character/narrator visibility, cached previews, completed recap preservation, resume, and transfer dependencies. - `pnpm check` passes, including localization, formatting, lint/types and production builds. - `pnpm regression:prompt` passes all three prompt, attachment and context-fit lanes. - Local CodeRabbit reviews of the initial patch and final adjustment completed with zero findings. The GitHub review identified one valid timeframe fallback issue; it was reproduced and fixed with regression coverage. - GitHub's final CodeRabbit recheck reports no actionable comments. Its optional docstring-coverage warning is left as-is: this focused filtering change keeps the existing internal function contracts, with the boundary rules covered by the guide and regressions. - A local runtime container using the freshly built workspace artifacts started successfully and returned HTTP 200 from `/api/health`. The full dependency/container rebuild is also exercised by required GitHub CI. ### Manual verification notes Manually verify the final prompt inspector with a shared context start inside a scene and existing ranged manual summaries: live messages should have no overlapping full recap, while older memories remain available. No interactive browser session was performed for this server-only change. Actual generation, dry-run preview and historical regeneration are exercised by the API regression. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs and CHANGELOG as needed - [ ] Translated docs updated or a follow-up issue opened - [ ] Version/release files updated Updated `docs/agents/memory.md` and `CHANGELOG.md`; #6467 includes the translation follow-up. No release metadata, storage-format or dependency changes. ## UI evidence (if applicable) No interface changes. --- <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:23 +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#7191
No description provided.