[PR #8607] [MERGED] perf(memory): cache parsed message extras #8698

Closed
opened 2026-11-07 17:39:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8607
Author: @gcyrus
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/8606-cache-advanced-memory-extras


📝 Commits (4)

  • 3f5028c perf(memory): cache parsed message extras
  • 9ece139 Merge branch 'staging' into fix/8606-cache-advanced-memory-extras
  • a938525 fix(memory): evict extras for deleted chats
  • 849a6d4 Merge branch 'staging' into fix/8606-cache-advanced-memory-extras

📊 Changes

2 files changed (+76 additions, -5 deletions)

View changed files

📝 packages/server/src/services/advanced-memory.ts (+33 -5)
📝 scripts/regressions/advanced-memory-prepare-scale.regression.ts (+43 -0)

📄 Description

Linked issue

Closes #8606

Why this change

Large Roleplay and Game chats rebuilt Advanced Memory contexts by parsing every stored message's unchanged extra metadata on every operation. The repeated parsing and allocation can block the Node event loop before generation begins.

What changed

  • Cache parsed message extras by chat and message while their raw stored value is unchanged.
  • Refresh only an edited message's cached extra and prune entries for deleted messages.
  • Add regression coverage for cache reuse and targeted invalidation.

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

Manual verification notes

  • pnpm check passed in an isolated copy of the branch inside the Docker builder image.
  • The focused advanced-memory-prepare-scale regression passed inside that builder image.
  • Local pnpm is unavailable on the host; the isolated container copy avoids changing the PR worktree.
  • No browser or UI behavior is changed.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

UI evidence (if applicable)

Not applicable; this is server-side Advanced Memory caching.


🔄 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/8607 **Author:** [@gcyrus](https://github.com/gcyrus) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/8606-cache-advanced-memory-extras` --- ### 📝 Commits (4) - [`3f5028c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3f5028cf3c857a1982f3f78ea0ed9b6dd5b6f0ef) perf(memory): cache parsed message extras - [`9ece139`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9ece139797937a073614184cd8896c1042ffbf69) Merge branch 'staging' into fix/8606-cache-advanced-memory-extras - [`a938525`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a9385256fced377fe422fdcf44598d6d6f7abb7f) fix(memory): evict extras for deleted chats - [`849a6d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/849a6d48292ce745c9d1d01bfe7666031fabf81b) Merge branch 'staging' into fix/8606-cache-advanced-memory-extras ### 📊 Changes **2 files changed** (+76 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/advanced-memory.ts` (+33 -5) 📝 `scripts/regressions/advanced-memory-prepare-scale.regression.ts` (+43 -0) </details> ### 📄 Description ## Linked issue Closes #8606 ## Why this change Large Roleplay and Game chats rebuilt Advanced Memory contexts by parsing every stored message's unchanged `extra` metadata on every operation. The repeated parsing and allocation can block the Node event loop before generation begins. ## What changed - Cache parsed message extras by chat and message while their raw stored value is unchanged. - Refresh only an edited message's cached extra and prune entries for deleted messages. - Add regression coverage for cache reuse and targeted invalidation. ## 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` ### Manual verification notes - `pnpm check` passed in an isolated copy of the branch inside the Docker builder image. - The focused `advanced-memory-prepare-scale` regression passed inside that builder image. - Local `pnpm` is unavailable on the host; the isolated container copy avoids changing the PR worktree. - No browser or UI behavior is changed. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) ## UI evidence (if applicable) Not applicable; this is server-side Advanced Memory caching. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:01 +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#8698
No description provided.