[PR #6527] [MERGED] fix(memory): identify blocked corrections and recover missing scenes #7214

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept22-memory-repair


📝 Commits (6)

  • 2a8b7a7 docs: track Advanced Memory recovery fix
  • a1b9cb4 fix(memory): preserve indexes and recover missing scene summaries
  • d47e2fa fix(memory): make completed scene repairs safe to retry
  • d714467 Merge remote-tracking branch 'origin/staging' into codex/sept22-memory-repair
  • 1378052 fix(memory): announce recovery notices and strengthen UI proof
  • bfb062b Merge remote-tracking branch 'origin/staging' into codex/sept22-memory-repair

📊 Changes

10 files changed (+479 additions, -40 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 e2e/advanced-memory.e2e.ts (+94 -0)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+39 -0)
📝 packages/client/src/hooks/use-advanced-memory.ts (+2 -1)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/server/src/routes/advanced-memory.routes.ts (+2 -0)
📝 packages/server/src/services/advanced-memory.ts (+165 -30)
📝 packages/shared/src/types/advanced-memory.ts (+6 -0)
📝 scripts/regressions/advanced-memory-core.regression.ts (+156 -9)
📝 scripts/regressions/advanced-memory-inspector.regression.ts (+8 -0)

📄 Description

Linked issue

Closes #6526

Why this change

Preparing Advanced Memory could reject a manually corrected scene after an ordinary message edit, swipe, illustration, or live context cutoff, without identifying the affected memory. A closed scene whose summary was never completed could also disappear from the inspector, leaving an unexplained gap such as Messages 948–992.

What changed

  • Keep completed scene/excerpt indexes across ordinary edits and swipes. Recalled excerpts read the current message text; saved corrections remain intact. Hidden-message access, knowledge starts, source-ID coverage, dependencies, import validation, and in-flight revision checks still apply.
  • Include the affected message range and audience in correction errors, with a direct Review button that opens the existing editor.
  • Show unfinished closed ranges in Access memories for this chat. Prepare scene summarizes/indexes only the selected gap through the existing preparation flow, preserving other scenes and progress checkpoints. Resume processing also fills missing summaries; Reindex only rebuilds existing vectors. Deliberately excluded/deleted memories are not resurrected.
  • Count newly added messages for standalone scene checks, so edits/swipes do not restart the cadence. Retrying an already completed scene repair is a no-op.

Validation

Completed automated checks:

  • pnpm check (localization, formatting, lint, TypeScript, and production builds).
  • node scripts/run-regressions.mjs --filter advanced-memory: 8/8 passed, including 800-message preparation/resume, edits and swipe recall, access isolation, imports, stale in-flight work, missing scaffolds, targeted recovery, correction preservation, and the 1,000-message inspector performance fixture.
  • Advanced Memory browser coverage on desktop Chromium, mobile Chromium, and iPhone WebKit: 30/33 passed in the full run before a temporary disk-space failure; all affected cases plus the new recovery case passed in the final targeted rerun (9/9).
  • The final recovery UI case passed again on all three browser targets after the review fixes (3/3). Local pnpm check and all eight memory regressions also passed after merging the latest staging base.
  • Full ARM64 Docker image built and passed node scripts/smoke-container.mjs marinara-6527-check full arm64 (API/frontend, native dependencies, non-root runtime, persistence, clean shutdown).
  • Local CodeRabbit reviewed the branch twice. Its three findings were addressed with regression coverage: stale errors after successful recovery, overlapping summaries masking a gap, and duplicate recovery requests creating errors.
  • GitHub CodeRabbit: added a persistent polite live region for recovery notices and replaced an object-identity test assertion with a check of the preserved correction shown in the UI. The suggested status-validation cache is deferred: the existing 1,000-message/354-record fixture completes the status GET in 21 ms and concurrent idle status, preset editing, and character listing in 15 ms. Idle polling remains disabled; this measured performance does not justify adding cache state to source/access validation in this repair.

Human verification checklist (left unchecked for the maintainer):

  • 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

Manual verification notes

Manually verify on the affected chat after updating/restarting staging: open Chat Settings → Access memories for this chat, prepare the missing range, and confirm existing corrections/summaries remain. If a correction genuinely needs review, follow its Review button, save the correction, and resume. Confirm an edited message and alternate swipe are recalled using their current text. Physical iPhone/PWA testing remains a maintainer check; local mobile proof uses browser emulation and synthetic fixtures.

Docs and release impact

Updated CHANGELOG.md and the canonical English UI catalog. No version bump or changes to translated user documentation.

UI evidence

Before/after and recovered-state screenshots: desktop and iPhone WebKit, light and dark themes. All screenshots use synthetic test data.


🔄 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/6527 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/22/2026 **Status:** ✅ Merged **Merged:** 9/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/sept22-memory-repair` --- ### 📝 Commits (6) - [`2a8b7a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2a8b7a72baccde9c4b3d7528975f285d6f14dec1) docs: track Advanced Memory recovery fix - [`a1b9cb4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a1b9cb4eb50aca2765bd3dcfd346ced1eda5fd76) fix(memory): preserve indexes and recover missing scene summaries - [`d47e2fa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d47e2fac1ae74386807d9a8bcfa06932f4dbba8f) fix(memory): make completed scene repairs safe to retry - [`d714467`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7144673f61049c27a91d181d212b073ebc81737) Merge remote-tracking branch 'origin/staging' into codex/sept22-memory-repair - [`1378052`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1378052a1a531e38b426b6fb285aded94eb992c7) fix(memory): announce recovery notices and strengthen UI proof - [`bfb062b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bfb062bc6fa9c50342d4f2b4fea77ff8b9460a5f) Merge remote-tracking branch 'origin/staging' into codex/sept22-memory-repair ### 📊 Changes **10 files changed** (+479 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `e2e/advanced-memory.e2e.ts` (+94 -0) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+39 -0) 📝 `packages/client/src/hooks/use-advanced-memory.ts` (+2 -1) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/server/src/routes/advanced-memory.routes.ts` (+2 -0) 📝 `packages/server/src/services/advanced-memory.ts` (+165 -30) 📝 `packages/shared/src/types/advanced-memory.ts` (+6 -0) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+156 -9) 📝 `scripts/regressions/advanced-memory-inspector.regression.ts` (+8 -0) </details> ### 📄 Description ## Linked issue Closes #6526 ## Why this change Preparing Advanced Memory could reject a manually corrected scene after an ordinary message edit, swipe, illustration, or live context cutoff, without identifying the affected memory. A closed scene whose summary was never completed could also disappear from the inspector, leaving an unexplained gap such as Messages 948–992. ## What changed - Keep completed scene/excerpt indexes across ordinary edits and swipes. Recalled excerpts read the current message text; saved corrections remain intact. Hidden-message access, knowledge starts, source-ID coverage, dependencies, import validation, and in-flight revision checks still apply. - Include the affected message range and audience in correction errors, with a direct Review button that opens the existing editor. - Show unfinished closed ranges in Access memories for this chat. **Prepare scene** summarizes/indexes only the selected gap through the existing preparation flow, preserving other scenes and progress checkpoints. Resume processing also fills missing summaries; Reindex only rebuilds existing vectors. Deliberately excluded/deleted memories are not resurrected. - Count newly added messages for standalone scene checks, so edits/swipes do not restart the cadence. Retrying an already completed scene repair is a no-op. ## Validation Completed automated checks: - `pnpm check` (localization, formatting, lint, TypeScript, and production builds). - `node scripts/run-regressions.mjs --filter advanced-memory`: 8/8 passed, including 800-message preparation/resume, edits and swipe recall, access isolation, imports, stale in-flight work, missing scaffolds, targeted recovery, correction preservation, and the 1,000-message inspector performance fixture. - Advanced Memory browser coverage on desktop Chromium, mobile Chromium, and iPhone WebKit: 30/33 passed in the full run before a temporary disk-space failure; all affected cases plus the new recovery case passed in the final targeted rerun (9/9). - The final recovery UI case passed again on all three browser targets after the review fixes (3/3). Local `pnpm check` and all eight memory regressions also passed after merging the latest staging base. - Full ARM64 Docker image built and passed `node scripts/smoke-container.mjs marinara-6527-check full arm64` (API/frontend, native dependencies, non-root runtime, persistence, clean shutdown). - Local CodeRabbit reviewed the branch twice. Its three findings were addressed with regression coverage: stale errors after successful recovery, overlapping summaries masking a gap, and duplicate recovery requests creating errors. - GitHub CodeRabbit: added a persistent polite live region for recovery notices and replaced an object-identity test assertion with a check of the preserved correction shown in the UI. The suggested status-validation cache is deferred: the existing 1,000-message/354-record fixture completes the status GET in 21 ms and concurrent idle status, preset editing, and character listing in 15 ms. Idle polling remains disabled; this measured performance does not justify adding cache state to source/access validation in this repair. Human verification checklist (left unchecked for the maintainer): - [ ] `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` ### Manual verification notes Manually verify on the affected chat after updating/restarting staging: open Chat Settings → Access memories for this chat, prepare the missing range, and confirm existing corrections/summaries remain. If a correction genuinely needs review, follow its Review button, save the correction, and resume. Confirm an edited message and alternate swipe are recalled using their current text. Physical iPhone/PWA testing remains a maintainer check; local mobile proof uses browser emulation and synthetic fixtures. ## Docs and release impact Updated `CHANGELOG.md` and the canonical English UI catalog. No version bump or changes to translated user documentation. ## UI evidence [Before/after and recovered-state screenshots: desktop and iPhone WebKit, light and dark themes](https://gist.github.com/SpicyMarinara/6f182d50c4d09fea408115532a85c0ae). All screenshots use synthetic test data. --- <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:35 +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#7214
No description provided.