[PR #6534] [MERGED] fix(memory): keep one scene memory with explicit participant access #7217

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

📋 Pull Request Information

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

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


📝 Commits (9)

  • 3d85532 docs: track Advanced Memory scene audience fix
  • f3d79b8 fix(memory): assign one scene memory to its actual participants
  • 1b66ddb Merge branch 'staging' into codex/sept22-memory-audience
  • 4658b16 fix(memory): preserve canonical scene selection in backup imports
  • cda4c03 Merge remote-tracking branch 'origin/codex/sept22-memory-audience' into codex/sept22-memory-audience
  • 27f509b perf(memory): check correction access once per scene
  • 753b054 test(memory): count scene copies separately from indexed excerpts
  • e866196 fix(memory): normalize helper output before reading scene access
  • 1a79efb fix(memory): retain saved recaps after interrupted access checks

📊 Changes

11 files changed (+575 additions, -253 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/advanced-memory.e2e.ts (+10 -8)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+15 -22)
📝 packages/client/src/localization/locales/en.json (+5 -3)
📝 packages/server/src/services/advanced-memory.ts (+223 -198)
📝 packages/shared/src/types/advanced-memory.ts (+4 -1)
➕ scripts/regressions/advanced-memory-audience.regression.ts (+294 -0)
📝 scripts/regressions/advanced-memory-core.regression.ts (+11 -10)
📝 scripts/regressions/advanced-memory-history-start.regression.ts (+2 -3)
📝 scripts/regressions/advanced-memory-post-generation.regression.ts (+1 -0)
📝 scripts/regressions/advanced-memory-summary.regression.ts (+9 -8)

📄 Description

Linked issue

Closes #6533

Why this change

Advanced Memory prepared separate scene copies from each character's readable history. That assigned scenes to absent or inactive roster members even though source visibility does not establish participation. Empty audiences also behaved like shared access.

What changed

  • Store one scene recap with multiple participant IDs. The existing summary call returns actual participants; mentions, authorship and roster membership do not establish presence. Explicit "all" expands the current character list; missing/unknown/empty participation means narrator only. The narrator always has access without a separate copy.
  • Enforce scene access for both recaps and excerpts, including shared mode and mixed-character requests. Keep existing source hiding and knowledge-start checks.
  • Coalesce legacy duplicate cards immediately. Old automatic audience assignments are untrusted until reviewed: they grant narrator access only. Prepare existing history checks those scenes' participants using their original messages while preserving valid saved summaries. This runs only during explicit preparation, never before generation or normal background maintenance. Alternatively, save character access manually without a model call.
  • Reuse the existing editor, confirmation and storage fields. Clearing all participants is allowed. Read/toggle operations preserve old duplicate texts; explicit correction saves consolidate them. Backup exports retain originals and put the displayed recap first, so import cannot replace it with another character's copy.
  • Parse thinking blocks, JSON fences and Gemma string delimiters consistently for both recap and access-only responses.
  • Prefer saved recap text over an empty work row after an interrupted participant check; keep the participant metadata descriptor shared between client and server.

Validation

Human checklist intentionally left unchecked:

  • 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

Recorded automated proof:

  • pnpm install --frozen-lockfile, pnpm check, pnpm regression:prompt passed.
  • node scripts/run-regressions.mjs --filter advanced-memory — 9/9 passed. Covers narrator-only defaults, absent characters, explicit all, shared/individual access, legacy repairs, source hiding, toggles, deletion, backup ordering, model-output formatting and interrupted access checks. Reindexing is explicitly proven to make no summary/classification calls.
  • pnpm exec playwright test e2e/advanced-memory.e2e.ts --workers=3 — 27/27 passed across desktop Chromium, mobile Chromium and iPhone WebKit; the three editor cases passed again after the recovery follow-up.
  • Full ARM64 Docker image built and passed API/frontend/native-binding, persistent-data, non-root and shutdown checks before the final parser-only adjustment. The stock smoke script races the entrypoint's UID drop; the local proof copy waits for that drop before applying its unchanged assertions. GitHub's container check also passed on final head 1a79efba1.

Local CodeRabbit review completed and was rerun after substantive fixes; the final recovery/shared-descriptor follow-up returned zero findings. Valid findings fixed: toggle-only requests must preserve duplicate texts/original ACLs; source eligibility should be computed once per correction; helper output needs provider normalization; an interrupted access worker must not hide its saved recap; the client/server audience descriptor must be shared. Also simplified the redundant boolean. Dismissed: a terminology preference that conflicts with the existing knowledge-start wording; a reported duplicate finally that is absent in the actual file (single cleanup block, executable regression passes).

Manual verification notes

Browser automation exercised editing/clearing access, saving text, toggling recall, deleting with confirmation, error recovery, light/dark themes and desktop/mobile layouts. Screenshots were visually inspected.

Manually verify participant choices with the actual helper model and a real roleplay transcript, including an inactive character who is merely discussed and a user-only scene. Model judgment is not guaranteed by mocked provider tests. Mobile WebKit emulation is covered; a physical iPhone app was not tested.

An optional macOS native job timed out in the unchanged development-mode busy-terminal shutdown fixture after saving data and releasing its lease. Its install/build steps passed; a rerun was requested. All eight required merge checks passed.

Docs and release impact

User-focused [Unreleased] changelog entry included. No version, storage-layout or translated-doc changes.

UI evidence (if applicable)

Before/after desktop and iPhone WebKit screenshots, using synthetic fixtures only.


🔄 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/6534 **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-audience` --- ### 📝 Commits (9) - [`3d85532`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3d8553209f86c2ccd3784ca3bebdd2e1e5915b84) docs: track Advanced Memory scene audience fix - [`f3d79b8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f3d79b8cf92dbde8f8f1e4ca515a22bccaa299c6) fix(memory): assign one scene memory to its actual participants - [`1b66ddb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1b66ddb960c580fe3ab19bdba9b2d232a1e4d62f) Merge branch 'staging' into codex/sept22-memory-audience - [`4658b16`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4658b16c4278ba4565e892caef188599d6898757) fix(memory): preserve canonical scene selection in backup imports - [`cda4c03`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cda4c03f81ceec64f36bcb09e11bf38377826eda) Merge remote-tracking branch 'origin/codex/sept22-memory-audience' into codex/sept22-memory-audience - [`27f509b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/27f509bbee69e242c2b96ca6e0807a8f7a2f3e11) perf(memory): check correction access once per scene - [`753b054`](https://github.com/Pasta-Devs/Marinara-Engine/commit/753b054ef075242b705f7c7a13c5b87a2917b988) test(memory): count scene copies separately from indexed excerpts - [`e866196`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e86619643f5c30e01044766ac2751c60ce410d6e) fix(memory): normalize helper output before reading scene access - [`1a79efb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a79efba1e669d06672013e3d158227f722512e3) fix(memory): retain saved recaps after interrupted access checks ### 📊 Changes **11 files changed** (+575 additions, -253 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/advanced-memory.e2e.ts` (+10 -8) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+15 -22) 📝 `packages/client/src/localization/locales/en.json` (+5 -3) 📝 `packages/server/src/services/advanced-memory.ts` (+223 -198) 📝 `packages/shared/src/types/advanced-memory.ts` (+4 -1) ➕ `scripts/regressions/advanced-memory-audience.regression.ts` (+294 -0) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+11 -10) 📝 `scripts/regressions/advanced-memory-history-start.regression.ts` (+2 -3) 📝 `scripts/regressions/advanced-memory-post-generation.regression.ts` (+1 -0) 📝 `scripts/regressions/advanced-memory-summary.regression.ts` (+9 -8) </details> ### 📄 Description ## Linked issue Closes #6533 ## Why this change Advanced Memory prepared separate scene copies from each character's readable history. That assigned scenes to absent or inactive roster members even though source visibility does not establish participation. Empty audiences also behaved like shared access. ## What changed - Store one scene recap with multiple participant IDs. The existing summary call returns actual participants; mentions, authorship and roster membership do not establish presence. Explicit `"all"` expands the current character list; missing/unknown/empty participation means narrator only. The narrator always has access without a separate copy. - Enforce scene access for both recaps and excerpts, including shared mode and mixed-character requests. Keep existing source hiding and knowledge-start checks. - Coalesce legacy duplicate cards immediately. Old automatic audience assignments are untrusted until reviewed: they grant narrator access only. **Prepare existing history** checks those scenes' participants using their original messages while preserving valid saved summaries. This runs only during explicit preparation, never before generation or normal background maintenance. Alternatively, save character access manually without a model call. - Reuse the existing editor, confirmation and storage fields. Clearing all participants is allowed. Read/toggle operations preserve old duplicate texts; explicit correction saves consolidate them. Backup exports retain originals and put the displayed recap first, so import cannot replace it with another character's copy. - Parse thinking blocks, JSON fences and Gemma string delimiters consistently for both recap and access-only responses. - Prefer saved recap text over an empty work row after an interrupted participant check; keep the participant metadata descriptor shared between client and server. ## Validation Human checklist intentionally left unchecked: - [ ] `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` Recorded automated proof: - `pnpm install --frozen-lockfile`, `pnpm check`, `pnpm regression:prompt` passed. - `node scripts/run-regressions.mjs --filter advanced-memory` — 9/9 passed. Covers narrator-only defaults, absent characters, explicit all, shared/individual access, legacy repairs, source hiding, toggles, deletion, backup ordering, model-output formatting and interrupted access checks. Reindexing is explicitly proven to make no summary/classification calls. - `pnpm exec playwright test e2e/advanced-memory.e2e.ts --workers=3` — 27/27 passed across desktop Chromium, mobile Chromium and iPhone WebKit; the three editor cases passed again after the recovery follow-up. - Full ARM64 Docker image built and passed API/frontend/native-binding, persistent-data, non-root and shutdown checks before the final parser-only adjustment. The stock smoke script races the entrypoint's UID drop; the local proof copy waits for that drop before applying its unchanged assertions. GitHub's container check also passed on final head `1a79efba1`. Local CodeRabbit review completed and was rerun after substantive fixes; the final recovery/shared-descriptor follow-up returned zero findings. Valid findings fixed: toggle-only requests must preserve duplicate texts/original ACLs; source eligibility should be computed once per correction; helper output needs provider normalization; an interrupted access worker must not hide its saved recap; the client/server audience descriptor must be shared. Also simplified the redundant boolean. Dismissed: a terminology preference that conflicts with the existing knowledge-start wording; a reported duplicate `finally` that is absent in the actual file (single cleanup block, executable regression passes). ### Manual verification notes Browser automation exercised editing/clearing access, saving text, toggling recall, deleting with confirmation, error recovery, light/dark themes and desktop/mobile layouts. Screenshots were visually inspected. Manually verify participant choices with the actual helper model and a real roleplay transcript, including an inactive character who is merely discussed and a user-only scene. Model judgment is not guaranteed by mocked provider tests. Mobile WebKit emulation is covered; a physical iPhone app was not tested. An optional macOS native job timed out in the unchanged development-mode busy-terminal shutdown fixture after saving data and releasing its lease. Its install/build steps passed; a rerun was requested. All eight required merge checks passed. ## Docs and release impact User-focused `[Unreleased]` changelog entry included. No version, storage-layout or translated-doc changes. ## UI evidence (if applicable) [Before/after desktop and iPhone WebKit screenshots](https://gist.github.com/SpicyMarinara/39adcc2d50b18220b57cb2e0f899ddb2), using synthetic fixtures only. --- <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:37 +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#7217
No description provided.