[PR #6632] [MERGED] fix: scan globally hidden Roleplay history in Advanced Memory #7263

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

📋 Pull Request Information

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

Base: staging ← Head: codex/advanced-memory-hidden-history


📝 Commits (8)

  • 036ff70 docs: track hidden history memory fix (#6631)
  • c412359 fix: retain globally hidden history in Advanced Memory
  • cdf7a05 fix: allow audience-only review of hidden source gaps
  • f29f0e2 fix: preserve corrections across recovered scene boundaries
  • b8cbf55 Merge remote-tracking branch 'origin/staging' into codex/advanced-memory-hidden-history
  • bc43b1f fix: reject stale memory corrections after scene recovery
  • 3ca79f3 fix: prefer recovered memory boundaries in the inspector
  • ab0d7bc fix: validate recovered scenes and preserve inspector performance

📊 Changes

8 files changed (+607 additions, -61 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/agents/memory.md (+3 -3)
📝 packages/server/src/services/advanced-memory.ts (+153 -42)
📝 scripts/regressions/advanced-memory-audience.regression.ts (+241 -1)
📝 scripts/regressions/advanced-memory-core.regression.ts (+1 -1)
📝 scripts/regressions/advanced-memory-history-start.regression.ts (+3 -3)
📝 scripts/regressions/advanced-memory-inspector.regression.ts (+36 -2)
📝 scripts/regressions/advanced-memory-recovery.regression.ts (+168 -9)

📄 Description

Linked issue

Closes #6631

Why this change

Roleplay chats that used automatic summaries lost globally hidden turns from Advanced Memory preparation. The same filter also skipped manually hidden messages. As requested by the maintainer, both kinds of global hide now remain available to the memory archive.

What changed

  • Scan, classify participants, summarize, and index globally hidden history during initial preparation, later scans, and post-generation scene checks.
  • Keep global hides out of the live transcript. Preserve character-specific hiding, confirmed knowledge ranges, scene participation, and command-only exclusions.
  • Recover old incomplete scan checkpoints and obsolete scene boundaries, including cancellation/resume, then reuse completed scene decisions when visibility changes.
  • Preserve existing manual corrections. If an old correction has a hidden source gap within the same scene, explicit Save correction can acknowledge that range without losing its text or bypassing character access. If a recovered scene boundary changes or disappears, preparation and editing instead give an actionable disable/delete recovery path; disabling preserves the text and original source range. Stale corrections cannot be re-enabled, including when a recovered scene reopens. The inspector uses valid recovered boundaries and checks each structural record against its own source range.
  • Update the memory guide and changelog. Translation follow-up: #6633.

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 omission with a failing hidden-history classification assertion before the fix.
  • All 10 Advanced Memory regression suites pass, including initial/later scans, embeddings, participant access, live-history exclusion, legacy recovery, cancellation, saved corrections, and visibility-only changes.
  • pnpm check, pnpm regression:prompt, and pnpm version:check passed. The full check also passed after integrating current staging and all correction/inspector review fixes.
  • Nine existing Advanced Memory browser checks passed across desktop Chromium, mobile Chromium, and mobile WebKit, covering Chat Settings, cutoff controls, and scene recovery.
  • Local and hosted CodeRabbit findings were reproduced or traced and addressed (boundary replacement, checkpoint reuse, legacy correction saves, reopened scenes, invalid scaffolds, and inspector performance). The final local review completed. Its SQLite-parameter-limit finding was rejected: db/connection.ts always creates FileNativeDB, and file-backed-store.ts processes insert row arrays directly, without SQL parameters. The regression uses that same backend.
  • A 10,000-message / 2,000-scene regression reproduced a 2.2-second inspector delay; checking each scene’s source range reduced it to 21 ms locally while retaining validity checks. The performance proof and invalid-source negative controls pass.
  • CodeRabbit’s docstring coverage advisory is informational; archive/live selection and recovery behavior are documented inline and in the memory guide.
  • The local Docker build was interrupted by insufficient disk space. Disposable task download caches were removed and OrbStack was restored. The hosted container build/runtime check is a required merge gate.

Manual verification notes

  • Manually verify Prepare existing history in an older Roleplay chat that used automatic summaries, inspecting recovered scenes and their character access with your own model.
  • Manually verify a saved correction if the inspector requests review of newly included source messages. If the scene boundary changed, disable the old correction to retain its text, then prepare history again.
  • Local model calls used deterministic fixtures, not the maintainer's chat data or a paid provider. The browser checks above are automated.

Docs and release impact

  • Changelog and docs/agents/memory.md updated; no app version or storage format change.
  • 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 #6633)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No client layout changes; recovery uses the existing memory inspector controls.


🔄 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/6632 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/24/2026 **Status:** ✅ Merged **Merged:** 9/24/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/advanced-memory-hidden-history` --- ### 📝 Commits (8) - [`036ff70`](https://github.com/Pasta-Devs/Marinara-Engine/commit/036ff702062c01437087b5bbac827c234a9b1c08) docs: track hidden history memory fix (#6631) - [`c412359`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c4123590eb91d3168a62953779ba58a2f0cd14c1) fix: retain globally hidden history in Advanced Memory - [`cdf7a05`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cdf7a05b537e17931f2d3801a9132b981f452e7d) fix: allow audience-only review of hidden source gaps - [`f29f0e2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f29f0e28bde9593348ce8265ab92f70699975280) fix: preserve corrections across recovered scene boundaries - [`b8cbf55`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b8cbf554d6523a7e773864a56cdb5dbec88e0532) Merge remote-tracking branch 'origin/staging' into codex/advanced-memory-hidden-history - [`bc43b1f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bc43b1ff9a999dd998f55f1ff8bd0cb76957ea31) fix: reject stale memory corrections after scene recovery - [`3ca79f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ca79f30ab8d7b5c83f2423ae9bdae364525e3eb) fix: prefer recovered memory boundaries in the inspector - [`ab0d7bc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ab0d7bc5e4f1f50ab9f36cfce911b6c902433c25) fix: validate recovered scenes and preserve inspector performance ### 📊 Changes **8 files changed** (+607 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/agents/memory.md` (+3 -3) 📝 `packages/server/src/services/advanced-memory.ts` (+153 -42) 📝 `scripts/regressions/advanced-memory-audience.regression.ts` (+241 -1) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+1 -1) 📝 `scripts/regressions/advanced-memory-history-start.regression.ts` (+3 -3) 📝 `scripts/regressions/advanced-memory-inspector.regression.ts` (+36 -2) 📝 `scripts/regressions/advanced-memory-recovery.regression.ts` (+168 -9) </details> ### 📄 Description ## Linked issue Closes #6631 ## Why this change Roleplay chats that used automatic summaries lost globally hidden turns from Advanced Memory preparation. The same filter also skipped manually hidden messages. As requested by the maintainer, both kinds of global hide now remain available to the memory archive. ## What changed - Scan, classify participants, summarize, and index globally hidden history during initial preparation, later scans, and post-generation scene checks. - Keep global hides out of the live transcript. Preserve character-specific hiding, confirmed knowledge ranges, scene participation, and command-only exclusions. - Recover old incomplete scan checkpoints and obsolete scene boundaries, including cancellation/resume, then reuse completed scene decisions when visibility changes. - Preserve existing manual corrections. If an old correction has a hidden source gap within the same scene, explicit Save correction can acknowledge that range without losing its text or bypassing character access. If a recovered scene boundary changes or disappears, preparation and editing instead give an actionable disable/delete recovery path; disabling preserves the text and original source range. Stale corrections cannot be re-enabled, including when a recovered scene reopens. The inspector uses valid recovered boundaries and checks each structural record against its own source range. - Update the memory guide and changelog. Translation follow-up: #6633. ## 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 omission with a failing hidden-history classification assertion before the fix. - All 10 Advanced Memory regression suites pass, including initial/later scans, embeddings, participant access, live-history exclusion, legacy recovery, cancellation, saved corrections, and visibility-only changes. - `pnpm check`, `pnpm regression:prompt`, and `pnpm version:check` passed. The full check also passed after integrating current staging and all correction/inspector review fixes. - Nine existing Advanced Memory browser checks passed across desktop Chromium, mobile Chromium, and mobile WebKit, covering Chat Settings, cutoff controls, and scene recovery. - Local and hosted CodeRabbit findings were reproduced or traced and addressed (boundary replacement, checkpoint reuse, legacy correction saves, reopened scenes, invalid scaffolds, and inspector performance). The final local review completed. Its SQLite-parameter-limit finding was rejected: `db/connection.ts` always creates `FileNativeDB`, and `file-backed-store.ts` processes insert row arrays directly, without SQL parameters. The regression uses that same backend. - A 10,000-message / 2,000-scene regression reproduced a 2.2-second inspector delay; checking each scene’s source range reduced it to 21 ms locally while retaining validity checks. The performance proof and invalid-source negative controls pass. - CodeRabbit’s docstring coverage advisory is informational; archive/live selection and recovery behavior are documented inline and in the memory guide. - The local Docker build was interrupted by insufficient disk space. Disposable task download caches were removed and OrbStack was restored. The hosted container build/runtime check is a required merge gate. ### Manual verification notes - Manually verify Prepare existing history in an older Roleplay chat that used automatic summaries, inspecting recovered scenes and their character access with your own model. - Manually verify a saved correction if the inspector requests review of newly included source messages. If the scene boundary changed, disable the old correction to retain its text, then prepare history again. - Local model calls used deterministic fixtures, not the maintainer's chat data or a paid provider. The browser checks above are automated. ## Docs and release impact - Changelog and `docs/agents/memory.md` updated; no app version or storage format change. - [ ] 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 #6633) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No client layout changes; recovery uses the existing memory inspector controls. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:03 +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#7263
No description provided.