[PR #6510] [MERGED] fix: preserve edited memories during reindexing #7206

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept21-memory-reindex-corrections


📝 Commits (2)

  • d5e5fed docs: track edited-memory reindex regression
  • 17a5cc3 fix: preserve scene corrections and only rebuild memory vectors on reindex

📊 Changes

7 files changed (+293 additions, -22 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/advanced-memory.e2e.ts (+13 -0)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+9 -2)
📝 packages/client/src/localization/locales/en.json (+2 -1)
📝 packages/server/src/routes/advanced-memory.routes.ts (+8 -2)
📝 packages/server/src/services/advanced-memory.ts (+71 -15)
📝 scripts/regressions/advanced-memory-core.regression.ts (+188 -2)

📄 Description

Linked issue

Closes #6509

Why this change

A manually edited scene could retain dependencies on an older Chat Summary. Editing its text or character access refreshed the message fingerprint but left those dependencies stale. Reindex then ran full archive preparation, tried to replace the correction, and stopped with a misleading source-message error. The editor also disabled Save correction when the text was already correct.

What changed

  • Reindex only rebuilds vectors for eligible saved scene and excerpt text. It does not classify messages or generate summaries, and it keeps the existing operation queue, cancellation and progress handling.
  • Saving a scene correction makes that text independent of previous generated-summary inputs. Message-range and character-access validation still apply.
  • Older stale scene corrections can be reviewed and saved unchanged in their existing editor. Reindex leaves unreviewed stale records untouched and excluded from recall.
  • Preparation detects stale manual scenes before spending tokens on a replacement summary. The error identifies both source and supporting-summary changes and points to the existing recovery action.

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:

  • Reproduced the original error without changing source messages: change a supporting constant's metadata, save a scene correction, then reindex. The regression failed on the original service and passes with this change.
  • node scripts/run-regressions.mjs --filter advanced-memory: 8/8 passed, including real generation, historical cutoffs, post-generation work and the large-archive inspector. The updated core suite also passes with the HTTP reindex/cancel/retry proof.
  • pnpm smoke:ui --grep 'stays in Chat Settings' --workers=2: passed on desktop Chromium, mobile Chromium and mobile WebKit. The recovery action sends the unchanged correction and becomes disabled once saved. A focused mobile WebKit rerun captured its light/dark recovery state.
  • Initial browser run was invalidated by running the build concurrently, which temporarily removed shared output; the subsequent isolated runs passed.
  • pnpm check: passed. Server type checks rerun after the queue correction. The pre-existing GameNarration effect-dependency warning remains.
  • Local CodeRabbit review completed. Its queue acknowledgement finding was reproduced and fixed; follow-up review confirmed that fix and identified a missing HTTP 400 mapping for inaccessible scene sources. Added the exact existing-style mapping and a failing-before/passing-after API regression. No findings were dismissed.

Manual verification notes

  • Inspected the captured mobile WebKit recovery view. No physical iPhone test was performed.
  • Manually verify on the affected installation: open the stale scene in Access memories for this chat, confirm its text and character access, choose Save correction without changing text, then Reindex. Existing archive summaries should remain intact.

Claim boundary

  • Tested: text and audience corrections, old manual dependencies, unchanged-text recovery, preserved summary text, embedding-only reindex calls, HTTP progress acknowledgement, cancellation/retry, overlapping index jobs, and later preparation retaining the audience correction.
  • Negative controls: unsupported imported corrections remain stale/disabled until reviewed, changed source messages do not silently replace corrections, and saving cannot grant access to hidden messages.
  • Uses synthetic fixtures; the maintainer's current private archive was not modified or uploaded. An older supplied export was inspected locally for dependency metadata 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
  • Version/release files updated (only if this PR includes a version bump)

Unreleased changelog and canonical English recovery copy updated. No storage-format, release-version, dependency or user-facing docs changes.

UI evidence (if applicable)

The existing Advanced Memory browser regression captures advanced-memory-review-correction-dark.png and advanced-memory-review-correction-light.png, including the enabled Save correction action with unchanged text. These are included in browser-test artifacts.

Summary by CodeRabbit

  • New Features

    • Advanced Memory reindexing now refreshes saved text vectors without rerunning scene detection or summarization.
    • Users can review and save manually corrected memories, including text that is already correct.
    • Reindexing provides clearer progress, cancellation, and retry behavior.
  • Bug Fixes

    • Improved guidance when corrected memories require source or summary review.
    • Added validation when scene sources are no longer available to selected characters.
    • Preserved manual edits and stale corrections during reindexing.

🔄 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/6510 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/21/2026 **Status:** ✅ Merged **Merged:** 9/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/sept21-memory-reindex-corrections` --- ### 📝 Commits (2) - [`d5e5fed`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d5e5feda093b33fb3e8c92bb5316a76d3ca55378) docs: track edited-memory reindex regression - [`17a5cc3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/17a5cc3c3778311e260f9f405d02528c238d100a) fix: preserve scene corrections and only rebuild memory vectors on reindex ### 📊 Changes **7 files changed** (+293 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/advanced-memory.e2e.ts` (+13 -0) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+9 -2) 📝 `packages/client/src/localization/locales/en.json` (+2 -1) 📝 `packages/server/src/routes/advanced-memory.routes.ts` (+8 -2) 📝 `packages/server/src/services/advanced-memory.ts` (+71 -15) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+188 -2) </details> ### 📄 Description ## Linked issue Closes #6509 ## Why this change A manually edited scene could retain dependencies on an older Chat Summary. Editing its text or character access refreshed the message fingerprint but left those dependencies stale. Reindex then ran full archive preparation, tried to replace the correction, and stopped with a misleading source-message error. The editor also disabled Save correction when the text was already correct. ## What changed - Reindex only rebuilds vectors for eligible saved scene and excerpt text. It does not classify messages or generate summaries, and it keeps the existing operation queue, cancellation and progress handling. - Saving a scene correction makes that text independent of previous generated-summary inputs. Message-range and character-access validation still apply. - Older stale scene corrections can be reviewed and saved unchanged in their existing editor. Reindex leaves unreviewed stale records untouched and excluded from recall. - Preparation detects stale manual scenes before spending tokens on a replacement summary. The error identifies both source and supporting-summary changes and points to the existing recovery action. ## 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: - Reproduced the original error without changing source messages: change a supporting constant's metadata, save a scene correction, then reindex. The regression failed on the original service and passes with this change. - `node scripts/run-regressions.mjs --filter advanced-memory`: 8/8 passed, including real generation, historical cutoffs, post-generation work and the large-archive inspector. The updated core suite also passes with the HTTP reindex/cancel/retry proof. - `pnpm smoke:ui --grep 'stays in Chat Settings' --workers=2`: passed on desktop Chromium, mobile Chromium and mobile WebKit. The recovery action sends the unchanged correction and becomes disabled once saved. A focused mobile WebKit rerun captured its light/dark recovery state. - Initial browser run was invalidated by running the build concurrently, which temporarily removed shared output; the subsequent isolated runs passed. - `pnpm check`: passed. Server type checks rerun after the queue correction. The pre-existing GameNarration effect-dependency warning remains. - Local CodeRabbit review completed. Its queue acknowledgement finding was reproduced and fixed; follow-up review confirmed that fix and identified a missing HTTP 400 mapping for inaccessible scene sources. Added the exact existing-style mapping and a failing-before/passing-after API regression. No findings were dismissed. ### Manual verification notes - Inspected the captured mobile WebKit recovery view. No physical iPhone test was performed. - Manually verify on the affected installation: open the stale scene in **Access memories for this chat**, confirm its text and character access, choose **Save correction** without changing text, then **Reindex**. Existing archive summaries should remain intact. ### Claim boundary - Tested: text and audience corrections, old manual dependencies, unchanged-text recovery, preserved summary text, embedding-only reindex calls, HTTP progress acknowledgement, cancellation/retry, overlapping index jobs, and later preparation retaining the audience correction. - Negative controls: unsupported imported corrections remain stale/disabled until reviewed, changed source messages do not silently replace corrections, and saving cannot grant access to hidden messages. - Uses synthetic fixtures; the maintainer's current private archive was not modified or uploaded. An older supplied export was inspected locally for dependency metadata 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 - [ ] Version/release files updated (only if this PR includes a version bump) Unreleased changelog and canonical English recovery copy updated. No storage-format, release-version, dependency or user-facing docs changes. ## UI evidence (if applicable) The existing Advanced Memory browser regression captures `advanced-memory-review-correction-dark.png` and `advanced-memory-review-correction-light.png`, including the enabled Save correction action with unchanged text. These are included in browser-test artifacts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Advanced Memory reindexing now refreshes saved text vectors without rerunning scene detection or summarization. - Users can review and save manually corrected memories, including text that is already correct. - Reindexing provides clearer progress, cancellation, and retry behavior. - **Bug Fixes** - Improved guidance when corrected memories require source or summary review. - Added validation when scene sources are no longer available to selected characters. - Preserved manual edits and stale corrections during reindexing. <!-- 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:17:31 +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#7206
No description provided.