[PR #7653] [MERGED] fix(memory): steady scene counter in Prepare, and no recollection asked for an edited or deleted one #7858

Closed
opened 2026-10-24 04:08:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7653
Author: @SpicyMarinara
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/memory-prepare-progress


📝 Commits (3)

  • 6a328e7 fix(memory): steady scene counter in Prepare, and no recollection asked for an edited or deleted one
  • 4955c9a fix(memory): clear a finished request's part, and ask only the requested characters for recollections
  • f9e66df Merge branch 'staging' into fix/memory-prepare-progress

📊 Changes

5 files changed (+67 additions, -9 deletions)

View changed files

📝 packages/server/src/services/advanced-memory.ts (+10 -3)
📝 packages/shared/src/types/advanced-memory.ts (+2 -0)
📝 scripts/regressions/advanced-memory-core.regression.ts (+2 -2)
📝 scripts/regressions/advanced-memory-recollections.regression.ts (+52 -3)
📝 scripts/regressions/advanced-memory-recovery.regression.ts (+1 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

No linked issue: requested by the maintainer on 2026-10-14. Follow-up to #7644 (review notes) and #7605.

Why this change

  • The Prepare counter jumped. It counts scenes (3/10), but each scene's summary request also wrote its own parts into the same counter, so it went 3/10 → 1/1 → 4/10. #7644 fixed this for recollection runs only.
  • Recollections that would be thrown away were paid for. When a scene is summarized again, the request still asked the Helper for a recollection from every participant, including one whose recollection was edited or deleted by hand. That one is kept, so the Helper's was thrown away after it was paid for.

What changed

  • AdvancedMemoryJob gains an optional part field ({ completed, total }). A scene's summary, access check and recollections report their parts there; completed/total keep counting scenes. A constant summary (its own job) still counts its parts in completed/total. Scene-level updates reset part to null.
  • A progress update still fires after each paid part. The two existing tests that cancel at that moment (advanced-memory-core ×2 and advanced-memory-recovery) now read part instead of completed/total. What they assert is unchanged: the paid part is kept and Resume reuses it.
  • A scene summarized again leaves out of the recollection request every character whose recollection of that scene is hand-edited or deleted (manualOverride).
  • Regressions in advanced-memory-recollections:
    • §14: Prepare's summarizing counter keeps one scene total throughout. Fail-before: 0/4, 1/1, 1/4, 1/1, 2/4, 1/1.
    • §15: Ada's recollection is deleted, then a message in the scene is removed so its generated summary is written again. Only Bram's card is sent, and Ada's stays deleted. Fail-before: Ada's card was sent too.

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

Commands run (results as reported, not a substitute for the boxes above):

  • pnpm check: exit 0. One existing lint warning in a client file this PR doesn't touch.
  • node scripts/run-regressions.mjs --filter advanced-memory: 18/18 passed.
  • Fail-before for §14 and §15 as listed above, each with only its own server change reverted.

Manual verification notes

  • Manually verify Prepare on a chat with many scenes: the counter goes up scene by scene and never shows 1/1 in between.
  • Manually verify a long scene that is summarized in parts still shows progress moving, and Cancel then Resume doesn't pay for the finished parts again.
  • Manually verify deleting a recollection in the Inspector, then changing that scene's messages and preparing: the summary is rewritten, and the deleted recollection stays deleted.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Summary by CodeRabbit

  • Bug Fixes
    • Progress updates now distinguish work completed within a request from scenes completed, providing clearer progress during summarization and recollection.
    • Re-summarizing a scene no longer replaces characters’ manually edited or deleted recollections.

🔄 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/7653 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/memory-prepare-progress` --- ### 📝 Commits (3) - [`6a328e7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6a328e7c3ddae809e5e08db53b3bc8a87ace28cc) fix(memory): steady scene counter in Prepare, and no recollection asked for an edited or deleted one - [`4955c9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4955c9aa60f2c0fb82ca61035c1d399ff8e9e061) fix(memory): clear a finished request's part, and ask only the requested characters for recollections - [`f9e66df`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f9e66dfe714499bf7268f7f6447605cee5e30492) Merge branch 'staging' into fix/memory-prepare-progress ### 📊 Changes **5 files changed** (+67 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/advanced-memory.ts` (+10 -3) 📝 `packages/shared/src/types/advanced-memory.ts` (+2 -0) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+2 -2) 📝 `scripts/regressions/advanced-memory-recollections.regression.ts` (+52 -3) 📝 `scripts/regressions/advanced-memory-recovery.regression.ts` (+1 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue No linked issue: requested by the maintainer on 2026-10-14. Follow-up to #7644 (review notes) and #7605. ## Why this change - **The Prepare counter jumped.** It counts scenes (3/10), but each scene's summary request also wrote its own parts into the same counter, so it went 3/10 → 1/1 → 4/10. #7644 fixed this for recollection runs only. - **Recollections that would be thrown away were paid for.** When a scene is summarized again, the request still asked the Helper for a recollection from every participant, including one whose recollection was edited or deleted by hand. That one is kept, so the Helper's was thrown away after it was paid for. ## What changed - `AdvancedMemoryJob` gains an optional `part` field (`{ completed, total }`). A scene's summary, access check and recollections report their parts there; `completed`/`total` keep counting scenes. A constant summary (its own job) still counts its parts in `completed`/`total`. Scene-level updates reset `part` to `null`. - A progress update still fires after each paid part. The two existing tests that cancel at that moment (`advanced-memory-core` ×2 and `advanced-memory-recovery`) now read `part` instead of `completed`/`total`. What they assert is unchanged: the paid part is kept and Resume reuses it. - A scene summarized again leaves out of the recollection request every character whose recollection of that scene is hand-edited or deleted (`manualOverride`). - Regressions in `advanced-memory-recollections`: - §14: Prepare's summarizing counter keeps one scene total throughout. Fail-before: `0/4, 1/1, 1/4, 1/1, 2/4, 1/1`. - §15: Ada's recollection is deleted, then a message in the scene is removed so its generated summary is written again. Only Bram's card is sent, and Ada's stays deleted. Fail-before: Ada's card was sent too. ## 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` Commands run (results as reported, not a substitute for the boxes above): - `pnpm check`: exit 0. One existing lint warning in a client file this PR doesn't touch. - `node scripts/run-regressions.mjs --filter advanced-memory`: 18/18 passed. - Fail-before for §14 and §15 as listed above, each with only its own server change reverted. ### Manual verification notes - Manually verify **Prepare** on a chat with many scenes: the counter goes up scene by scene and never shows 1/1 in between. - Manually verify a long scene that is summarized in parts still shows progress moving, and **Cancel** then **Resume** doesn't pay for the finished parts again. - Manually verify deleting a recollection in the Inspector, then changing that scene's messages and preparing: the summary is rewritten, and the deleted recollection stays deleted. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Progress updates now distinguish work completed within a request from scenes completed, providing clearer progress during summarization and recollection. * Re-summarizing a scene no longer replaces characters’ manually edited or deleted recollections. <!-- 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-24 04:08:12 +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#7858
No description provided.