[PR #7048] [MERGED] fix(memory): allow editing scene summary timeframes #7443

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

📋 Pull Request Information

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

Base: staging ← Head: fix/scene-summary-timeframes


📝 Commits (4)

  • 005ad02 chore: track scene timeframe editing for #7047
  • b4a493c fix(memory): allow editing scene summary timeframes
  • cd3019e fix(memory): preserve timeframe corrections across summary refreshes
  • f2a84f8 fix(memory): allow timeframe edits on empty imported summaries

📊 Changes

9 files changed (+602 additions, -36 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/advanced-memory.e2e.ts (+198 -4)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+29 -5)
📝 packages/client/src/hooks/use-advanced-memory.ts (+1 -1)
📝 packages/server/src/routes/advanced-memory.routes.ts (+4 -1)
📝 packages/server/src/services/advanced-memory.ts (+117 -21)
📝 packages/shared/src/types/advanced-memory.ts (+1 -1)
📝 scripts/regressions/advanced-memory-core.regression.ts (+1 -1)
📝 scripts/regressions/advanced-memory-summary.regression.ts (+249 -2)

📄 Description

Linked issue

Closes #7047

Why this change

Roleplay Advanced Memory displays a scene's Story timeframe, but the summary editor and save API did not let users correct it. An incorrect date could therefore remain in the archive and recalled memory even after the summary text was edited.

What changed

  • Added a Story timeframe field to saved scene summaries, using the existing Save correction button. Timeframe-only edits can be saved without changing the summary or character access; leaving it blank clears the timeframe.
  • Persisted timeframe corrections through the existing record API. Saved corrections take precedence over detected source dates in recalled scenes/excerpts and existing constant summaries, and survive later summary/access edits, automatic recap refreshes and memory transfers. No storage migration is needed.
  • Added API/prompt and browser regression coverage, and an Unreleased changelog entry.

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

Final implementation: f2a84f84a4a2e09594ec485368095e9c07773070.

  • pnpm check: passed (includes localization, formatting, lint/types and production build).
  • node scripts/run-regressions.mjs --filter advanced-memory: 11/11 passed, and pnpm regression:prompt: passed on cd3019eef355bca25974e2a3909f5047d3838619. The subsequent change only adjusts the client Save guard and its browser proof; server/shared code is unchanged.
  • PLAYWRIGHT_ONLY_PROJECT=desktop pnpm exec playwright test --project=desktop-chromium --grep 'Advanced Memory scene timeframes|@smoke' --workers=1: 8/8 passed. Covers real persistence, retry, reload, clearing, and timeframe-only saves on an imported empty open summary; deleting an existing nonempty summary remains blocked.
  • Earlier unchanged UI coverage on b4a493c5e5ea54c60c51ccf6d92408476440fe3c: focused timeframe scenario passed 3/3 on desktop Chromium, mobile Chromium and mobile WebKit; existing large-inspector scenario and seven shell smoke cases passed 8/8.
  • Linux ARM64 Docker build and node scripts/smoke-container.mjs marinara-7048-final full arm64: passed on cd3019eef355bca25974e2a3909f5047d3838619, including native dependencies, frontend assets, nonroot execution, persisted settings and clean shutdown. The final client guard passed the final local build/browser run, and the hosted container build/runtime check passed on the final revision.
  • Local CodeRabbit: initial full review had 0 findings; the follow-up full review found one minor empty-import Save issue, which was fixed. The final two-file follow-up review completed with 0 findings. Independent production review completed.

Review fixes

Both hosted findings were reproduced/traced and fixed: constant-summary rendering now honors saved scene timeframes even when the scene was already copied into constants, and timeframe-only edits preserve generated recap dependencies so source-summary changes can still refresh the text. Regression coverage also checks cleared dates, audience restrictions, cached-prompt invalidation, retaining dependencies when optional recall is dropped, and discarding deleted timing when explicitly regenerating a deleted scene.

The final hosted review suggested tracking only already-corrected scenes as constant-timing dependencies. This was not adopted: a prepared constant-only prompt must also be invalidated by the first timeframe correction. The existing regression in advanced-memory-summary.regression.ts prepares with retrieveMaxScenes: 0 before that first edit and asserts that validatePrepared rejects the old receipt afterward. Filtering out uncorrected scenes would remove the revision needed to detect that change. The conservative invalidation is intentional; an independent review confirmed this disposition. Review discussion.

Manual verification notes

Browser automation exercises real API persistence: edit only the timeframe, retry a failed save without losing the draft, save and reload, switch scenes, and clear an old timeframe. It checks that summary text, message IDs and character access stay unchanged. Screenshots are inspected in both themes.

Manually verify the Story timeframe field and Save correction on a physical phone; local mobile coverage uses browser emulation. All checklist boxes are intentionally left for the human contributor.

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)

Added a user-facing CHANGELOG.md entry. No installation, translated documentation, storage-version or release-version changes.

UI evidence (if applicable)

Before/after screenshots, desktop and both mobile engines in light/dark themes. All eight uploaded PNGs were verified against their local captures.


🔄 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/7048 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/4/2026 **Status:** ✅ Merged **Merged:** 10/4/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/scene-summary-timeframes` --- ### 📝 Commits (4) - [`005ad02`](https://github.com/Pasta-Devs/Marinara-Engine/commit/005ad028b18c6dd655b7d57f96c7ead569c0c6a8) chore: track scene timeframe editing for #7047 - [`b4a493c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b4a493c5e5ea54c60c51ccf6d92408476440fe3c) fix(memory): allow editing scene summary timeframes - [`cd3019e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd3019eef355bca25974e2a3909f5047d3838619) fix(memory): preserve timeframe corrections across summary refreshes - [`f2a84f8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f2a84f84a4a2e09594ec485368095e9c07773070) fix(memory): allow timeframe edits on empty imported summaries ### 📊 Changes **9 files changed** (+602 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/advanced-memory.e2e.ts` (+198 -4) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+29 -5) 📝 `packages/client/src/hooks/use-advanced-memory.ts` (+1 -1) 📝 `packages/server/src/routes/advanced-memory.routes.ts` (+4 -1) 📝 `packages/server/src/services/advanced-memory.ts` (+117 -21) 📝 `packages/shared/src/types/advanced-memory.ts` (+1 -1) 📝 `scripts/regressions/advanced-memory-core.regression.ts` (+1 -1) 📝 `scripts/regressions/advanced-memory-summary.regression.ts` (+249 -2) </details> ### 📄 Description ## Linked issue Closes #7047 ## Why this change Roleplay Advanced Memory displays a scene's Story timeframe, but the summary editor and save API did not let users correct it. An incorrect date could therefore remain in the archive and recalled memory even after the summary text was edited. ## What changed - Added a Story timeframe field to saved scene summaries, using the existing Save correction button. Timeframe-only edits can be saved without changing the summary or character access; leaving it blank clears the timeframe. - Persisted timeframe corrections through the existing record API. Saved corrections take precedence over detected source dates in recalled scenes/excerpts and existing constant summaries, and survive later summary/access edits, automatic recap refreshes and memory transfers. No storage migration is needed. - Added API/prompt and browser regression coverage, and an Unreleased changelog entry. ## 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` Final implementation: `f2a84f84a4a2e09594ec485368095e9c07773070`. - `pnpm check`: passed (includes localization, formatting, lint/types and production build). - `node scripts/run-regressions.mjs --filter advanced-memory`: 11/11 passed, and `pnpm regression:prompt`: passed on `cd3019eef355bca25974e2a3909f5047d3838619`. The subsequent change only adjusts the client Save guard and its browser proof; server/shared code is unchanged. - `PLAYWRIGHT_ONLY_PROJECT=desktop pnpm exec playwright test --project=desktop-chromium --grep 'Advanced Memory scene timeframes|@smoke' --workers=1`: 8/8 passed. Covers real persistence, retry, reload, clearing, and timeframe-only saves on an imported empty open summary; deleting an existing nonempty summary remains blocked. - Earlier unchanged UI coverage on `b4a493c5e5ea54c60c51ccf6d92408476440fe3c`: focused timeframe scenario passed 3/3 on desktop Chromium, mobile Chromium and mobile WebKit; existing large-inspector scenario and seven shell smoke cases passed 8/8. - Linux ARM64 Docker build and `node scripts/smoke-container.mjs marinara-7048-final full arm64`: passed on `cd3019eef355bca25974e2a3909f5047d3838619`, including native dependencies, frontend assets, nonroot execution, persisted settings and clean shutdown. The final client guard passed the final local build/browser run, and the hosted container build/runtime check passed on the final revision. - Local CodeRabbit: initial full review had 0 findings; the follow-up full review found one minor empty-import Save issue, which was fixed. The final two-file follow-up review completed with 0 findings. Independent production review completed. ### Review fixes Both hosted findings were reproduced/traced and fixed: constant-summary rendering now honors saved scene timeframes even when the scene was already copied into constants, and timeframe-only edits preserve generated recap dependencies so source-summary changes can still refresh the text. Regression coverage also checks cleared dates, audience restrictions, cached-prompt invalidation, retaining dependencies when optional recall is dropped, and discarding deleted timing when explicitly regenerating a deleted scene. The final hosted review suggested tracking only already-corrected scenes as constant-timing dependencies. This was not adopted: a prepared constant-only prompt must also be invalidated by the **first** timeframe correction. The existing regression in `advanced-memory-summary.regression.ts` prepares with `retrieveMaxScenes: 0` before that first edit and asserts that `validatePrepared` rejects the old receipt afterward. Filtering out uncorrected scenes would remove the revision needed to detect that change. The conservative invalidation is intentional; an independent review confirmed this disposition. [Review discussion](https://github.com/Pasta-Devs/Marinara-Engine/pull/7048#discussion_r4176989946). ### Manual verification notes Browser automation exercises real API persistence: edit only the timeframe, retry a failed save without losing the draft, save and reload, switch scenes, and clear an old timeframe. It checks that summary text, message IDs and character access stay unchanged. Screenshots are inspected in both themes. Manually verify the Story timeframe field and Save correction on a physical phone; local mobile coverage uses browser emulation. All checklist boxes are intentionally left for the human contributor. ## 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) Added a user-facing CHANGELOG.md entry. No installation, translated documentation, storage-version or release-version changes. ## UI evidence (if applicable) [Before/after screenshots, desktop and both mobile engines in light/dark themes](https://gist.github.com/SpicyMarinara/8949c1cb78b60badca57140083096196). All eight uploaded PNGs were verified against their local captures. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:19:50 +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#7443
No description provided.