[PR #7240] [MERGED] fix(memory): keep Fix from rewriting hand edits or keeping unconfirmed access #7639

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

📋 Pull Request Information

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

Base: staging ← Head: fix/advanced-memory-fix-followups-7234


📝 Commits (3)

  • dc95fe3 fix(memory): keep Fix from rewriting hand edits or keeping unconfirmed access
  • 99e665d fix(memory): Resume continues an ordinary job after a stopped Fix
  • 0515e56 Merge origin/staging into fix/advanced-memory-fix-followups-7234

📊 Changes

6 files changed (+120 additions, -12 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/memory.md (+3 -3)
📝 e2e/advanced-memory.e2e.ts (+25 -0)
📝 packages/client/src/components/chat/AdvancedMemorySettings.tsx (+2 -1)
📝 packages/server/src/services/advanced-memory.ts (+11 -6)
📝 scripts/regressions/advanced-memory-fix.regression.ts (+78 -2)

📄 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

Refs #7234 (follow-up to #7236, which merged while it was being verified)

Why this change

An adversarial review of Advanced Memory Fix (#7236) found two cases where it broke its own promises, and one where pausing it made things worse:

  • Fix rewrote a summary the user had edited by hand. When a message in that scene was hidden from the narrator and later shown again, Fix had the helper write a new summary over the user's text. It then counted that scene as "Fixed". The Fix box says Fix "never changes summaries you edited", and Mari's request said hand-corrected summaries must be listed for review, never overwritten.
  • Fix could keep a character in a scene that the helper no longer named. If the helper's new answer about who was there was still unclear, Fix kept the scene's old characters, even ones the helper had just left out. Mari's request says Fix must never give wider access than the helper's answer.
  • Resume after Pause ran normal preparation instead of Fix. Normal preparation stops with an error at the first hand-edited scene that needs review, so pausing Fix and then pressing Resume processing could end in an error that Fix itself avoids.

What changed

  • packages/server/src/services/advanced-memory.ts:
    • During Fix, a hand-edited summary that would need rewriting for any reason is left alone and listed under "need your review".
    • On an unclear answer, Fix keeps only the characters that both the scene's current access and the helper's new answer include. This applies to the participant re-check and to redone summaries. A missing answer still keeps the current access, as before.
  • packages/client/src/components/chat/AdvancedMemorySettings.tsx: Resume processing continues a paused or stopped Fix as a Fix. The Fix job already saves fixResult: null while it runs, so no new state is needed.
  • scripts/regressions/advanced-memory-fix.regression.ts: adds a second chat with both privacy cases. It fails without the server change, because the helper is asked to rewrite the hand edit.
  • e2e/advanced-memory.e2e.ts: extends the Fix test so that Resume processing after a paused Fix sends fixAll: true. It fails without the client change.
  • docs/agents/memory.md and CHANGELOG.md: the wording now matches this behavior. The feature is unreleased, so the existing #7234 entry is corrected and no second entry is added.

No existing test from staging was edited. Both test changes extend the new Fix tests that #7236 added.

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

Agent-run checks (for the record, not a substitute for the boxes above):

  • pnpm check exited 0 on this branch. It includes localization:check, format, lint, e2e types and the build.
  • Regressions: all 15 advanced-memory-* files pass, plus memory-recall-exclusivity, memory-recall-revectorize, roleplay-user-private-memory and native-export-memory.
  • Browser specs e2e/advanced-memory.e2e.ts and e2e/advanced-memory-wizard.e2e.ts on desktop-chromium and mobile-webkit:
    • 4 parallel workers: 39/40, then 37/40.
    • Every failure was on mobile-webkit, in a test this PR doesn't touch, during the first page load. The app crashed in App.tsx with InvalidStateError: The object is in an invalid state., right after WebKit logged "Unable to get image data from canvas. Requested size was 1 x 1" (syncLiteralBackground's getImageData). The failed tests passed when rerun with 1 worker.
    • The Fix test also passed on mobile-chromium.

Manual verification notes

  • Manually verify in a Roleplay group chat with Advanced Memory on:
    1. Prepare history.
    2. Edit a scene summary by hand in Access memories for this chat.
    3. Hide one of that scene's messages from the narrator, prepare again, then show it again.
    4. Press Fix. The hand-written text stays exactly as you wrote it, and the scene is listed under "need your review", not "Fixed".
  • Manually verify that a scene marked Check who was there, whose re-check still names someone unknown, loses any character the helper no longer names. It must not gain anyone, and it is listed for review.
  • Manually verify that pressing Pause processing during Fix and then Resume processing continues Fix: no "manually corrected memory … needs review" error, and the Fix result appears at the end.
  • Manually verify the Fix box, notice and result in light and dark mode, on a phone and with a keyboard only.

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 (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

docs/agents/memory.md changed again. The existing follow-up #7235 covers this file, and a comment there lists the new sentences.

UI evidence (if applicable)

No visual change. Resume processing now sends a Fix request after a paused Fix.

Summary by CodeRabbit

  • Improvements
    • Resuming a cancelled Advanced Memory fix now continues the fix process when needed.
    • Manually edited scene summaries are preserved and flagged for review if newly visible messages affect their coverage.
    • When the helper’s answer about scene participants is unclear, access is limited to characters included in both the previous and new answers.
  • Documentation
    • Clarified the Pause and Resume processing controls and updated guidance on how participant uncertainty affects access.

🔄 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/7240 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/advanced-memory-fix-followups-7234` --- ### 📝 Commits (3) - [`dc95fe3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dc95fe35933e7c8c308b22024ea62701205528b6) fix(memory): keep Fix from rewriting hand edits or keeping unconfirmed access - [`99e665d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/99e665d9e1e7810eef4c4ce2e17b165c1cb62733) fix(memory): Resume continues an ordinary job after a stopped Fix - [`0515e56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0515e561b579b0986e2398173391e18ce31bc254) Merge origin/staging into fix/advanced-memory-fix-followups-7234 ### 📊 Changes **6 files changed** (+120 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/memory.md` (+3 -3) 📝 `e2e/advanced-memory.e2e.ts` (+25 -0) 📝 `packages/client/src/components/chat/AdvancedMemorySettings.tsx` (+2 -1) 📝 `packages/server/src/services/advanced-memory.ts` (+11 -6) 📝 `scripts/regressions/advanced-memory-fix.regression.ts` (+78 -2) </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 Refs #7234 (follow-up to #7236, which merged while it was being verified) ## Why this change An adversarial review of Advanced Memory **Fix** (#7236) found two cases where it broke its own promises, and one where pausing it made things worse: - **Fix rewrote a summary the user had edited by hand.** When a message in that scene was hidden from the narrator and later shown again, Fix had the helper write a new summary over the user's text. It then counted that scene as "Fixed". The Fix box says Fix "never changes summaries you edited", and Mari's request said hand-corrected summaries must be listed for review, never overwritten. - **Fix could keep a character in a scene that the helper no longer named.** If the helper's new answer about who was there was still unclear, Fix kept the scene's old characters, even ones the helper had just left out. Mari's request says Fix must never give wider access than the helper's answer. - **Resume after Pause ran normal preparation instead of Fix.** Normal preparation stops with an error at the first hand-edited scene that needs review, so pausing Fix and then pressing **Resume processing** could end in an error that Fix itself avoids. ## What changed - `packages/server/src/services/advanced-memory.ts`: - During Fix, a hand-edited summary that would need rewriting for any reason is left alone and listed under "need your review". - On an unclear answer, Fix keeps only the characters that both the scene's current access and the helper's new answer include. This applies to the participant re-check and to redone summaries. A missing answer still keeps the current access, as before. - `packages/client/src/components/chat/AdvancedMemorySettings.tsx`: **Resume processing** continues a paused or stopped Fix as a Fix. The Fix job already saves `fixResult: null` while it runs, so no new state is needed. - `scripts/regressions/advanced-memory-fix.regression.ts`: adds a second chat with both privacy cases. It fails without the server change, because the helper is asked to rewrite the hand edit. - `e2e/advanced-memory.e2e.ts`: extends the Fix test so that **Resume processing** after a paused Fix sends `fixAll: true`. It fails without the client change. - `docs/agents/memory.md` and `CHANGELOG.md`: the wording now matches this behavior. The feature is unreleased, so the existing #7234 entry is corrected and no second entry is added. No existing test from `staging` was edited. Both test changes extend the new Fix tests that #7236 added. ## 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` Agent-run checks (for the record, not a substitute for the boxes above): - `pnpm check` exited 0 on this branch. It includes `localization:check`, format, lint, e2e types and the build. - Regressions: all 15 `advanced-memory-*` files pass, plus `memory-recall-exclusivity`, `memory-recall-revectorize`, `roleplay-user-private-memory` and `native-export-memory`. - Browser specs `e2e/advanced-memory.e2e.ts` and `e2e/advanced-memory-wizard.e2e.ts` on desktop-chromium and mobile-webkit: - 4 parallel workers: 39/40, then 37/40. - Every failure was on mobile-webkit, in a test this PR doesn't touch, during the first page load. The app crashed in `App.tsx` with `InvalidStateError: The object is in an invalid state.`, right after WebKit logged "Unable to get image data from canvas. Requested size was 1 x 1" (`syncLiteralBackground`'s `getImageData`). The failed tests passed when rerun with 1 worker. - The Fix test also passed on mobile-chromium. ### Manual verification notes - Manually verify in a Roleplay group chat with Advanced Memory on: 1. Prepare history. 2. Edit a scene summary by hand in **Access memories for this chat**. 3. Hide one of that scene's messages from the narrator, prepare again, then show it again. 4. Press **Fix**. The hand-written text stays exactly as you wrote it, and the scene is listed under "need your review", not "Fixed". - Manually verify that a scene marked **Check who was there**, whose re-check still names someone unknown, loses any character the helper no longer names. It must not gain anyone, and it is listed for review. - Manually verify that pressing **Pause processing** during Fix and then **Resume processing** continues Fix: no "manually corrected memory … needs review" error, and the Fix result appears at the end. - Manually verify the Fix box, notice and result in light and dark mode, on a phone and with a keyboard only. ## 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 (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `docs/agents/memory.md` changed again. The existing follow-up #7235 covers this file, and a comment there lists the new sentences. ## UI evidence (if applicable) No visual change. **Resume processing** now sends a Fix request after a paused Fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Resuming a cancelled Advanced Memory fix now continues the fix process when needed. * Manually edited scene summaries are preserved and flagged for review if newly visible messages affect their coverage. * When the helper’s answer about scene participants is unclear, access is limited to characters included in both the previous and new answers. * **Documentation** * Clarified the Pause and Resume processing controls and updated guidance on how participant uncertainty affects access. <!-- 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:06:05 +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#7639
No description provided.