[PR #7283] [MERGED] fix(memory): skip the Decision excerpt request when no excerpt can fit #7662

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

📋 Pull Request Information

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

Base: staging ← Head: fix/excerpts-behaviour-followup


📝 Commits (4)

  • 8e461f2 fix(memory): skip the Decision excerpt request when no excerpt can fit
  • 1375764 Merge origin/staging into fix/excerpts-behaviour-followup
  • 5efc10e Merge origin/staging into fix/excerpts-behaviour-followup
  • 1d39d36 Merge origin/staging into fix/excerpts-behaviour-followup

📊 Changes

5 files changed (+99 additions, -35 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/memory.md (+1 -1)
📝 packages/client/src/localization/locales/en.json (+1 -1)
📝 packages/server/src/services/advanced-memory.ts (+39 -33)
📝 scripts/regressions/advanced-memory-decisions.regression.ts (+57 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7269 (follow-up to #7277 and #7278, found while checking their behaviour)

Why this change

Mari asked whether recall with the Decision model (Jev) works correctly when scene summaries are picked but no message excerpts appear, and guessed it might be lack of room. In that exact case, when the summaries use up the memory space, recall still sent Jev its second request to pick messages from each chosen scene. No excerpt could fit, so the request only added a possible hosted charge and up to 10 seconds before the reply (each recall pass has a 10-second limit).

The receipt reason added in #7277/#7278 for that case also said "the summaries used all the memory space". That is not always true: a better scene's minimum excerpt, or one long message, can use the space too. In a local check with two recalled scenes, the first scene got a one-message excerpt and the second got none, and the receipt blamed the summaries.

What changed

  • packages/server/src/services/advanced-memory.ts, Decision message pass only:
    • An excerpt always keeps its centre, which is one of the scene's shortlisted messages (the model's best pick, or the best text match). A scene where not one of those messages fits on its own in the room the summaries left can get no excerpt, so its messages are no longer sent to the model.
    • When that leaves no scene, the second request is skipped. Every other recall outcome is unchanged: the same scenes, excerpts, receipt reasons and diagnostics as before.
    • excerptText moved earlier so the check can use the exact excerpt cost; its body is unchanged.
  • en.json: excerptNoRoom now reads "Some recalled scenes have no message excerpt because not enough memory space was left. A higher Summary and recall budget can make room."
  • docs/agents/memory.md: one sentence in Optional Decision model about the skipped request. Translation follow-up: #7282.
  • CHANGELOG.md: new [Unreleased] entry.
  • No model prompt changed, so debug prompt logging is untouched.

Behaviour matrix, run on origin/staging and on this branch with a fake Decision model (min 1, max 2 unless noted; solo, individual group with a hidden pick, scenes with private summary parts, merged group, min 3/max 5, min 0/max 2, min 0/max 0, constants near the budget, tight and roomy budgets, newcomers): every case recalled the same scenes and excerpts with the same reasons. The only difference is the new no-room case below.

Case Before After
Two long summaries leave less room than any scene message 2 scenes, 0 excerpts, excerpt-no-room, 2 Decision requests Same result, 1 Decision request (scenes only)
A short message still fits Second request sent Second request sent (it can still pick that message)

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

Agent-run checks (for the reviewer to confirm, not a substitute for the boxes above):

  • pnpm check and pnpm localization:check passed.
  • All 15 advanced-memory regressions, memory-recall (5/5), summary (5/5), roleplay-user-private-memory, native-export-memory and pnpm regression:prompt passed.
  • advanced-memory-decisions.regression.ts only gains a new block; no existing check changed. Its "not asked about messages that cannot fit" assertion fails on origin/staging and passes here.
  • Local CodeRabbit was rate limited when this PR opened; its result will be posted as a comment.

Manual verification notes

  • Manually verify in a Roleplay chat with Advanced Memory, Use Decision model and a Memory Decision connection on: lower Summary and recall budget until Peek Prompt shows scene summaries but no message excerpts, send a message, then open Peek Prompt → Decision diagnostics → Advanced Memory activity and check that the latest recall lists scene results but no message results, and says that some recalled scenes have no message excerpt.
  • Manually verify that the same chat with a larger Summary and recall budget still sends the second request and shows message excerpts.
  • Manually verify that the memory receipt for a scene without an excerpt reads "Some recalled scenes have no message excerpt because not enough memory space was left. A higher Summary and recall budget can make room."

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)

Docs: docs/agents/memory.md and CHANGELOG.md updated; translation follow-up #7282.

UI evidence (if applicable)

Receipt wording change only; no layout change.


🔄 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/7283 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/excerpts-behaviour-followup` --- ### 📝 Commits (4) - [`8e461f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e461f2f11752cf045d6000ed567b8ec0a1b2e2a) fix(memory): skip the Decision excerpt request when no excerpt can fit - [`1375764`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1375764f8ca1ae18b5b25dda17efdf72d4e15b3e) Merge origin/staging into fix/excerpts-behaviour-followup - [`5efc10e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5efc10ec09a2f9b1b74c9fdd3222c3e9327245d7) Merge origin/staging into fix/excerpts-behaviour-followup - [`1d39d36`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1d39d3606a628e5f530504f871ce8727a09f01a9) Merge origin/staging into fix/excerpts-behaviour-followup ### 📊 Changes **5 files changed** (+99 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/memory.md` (+1 -1) 📝 `packages/client/src/localization/locales/en.json` (+1 -1) 📝 `packages/server/src/services/advanced-memory.ts` (+39 -33) 📝 `scripts/regressions/advanced-memory-decisions.regression.ts` (+57 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7269 (follow-up to #7277 and #7278, found while checking their behaviour) ## Why this change Mari asked whether recall with the Decision model (Jev) works correctly when scene summaries are picked but no message excerpts appear, and guessed it might be lack of room. In that exact case, when the summaries use up the memory space, recall still sent Jev its second request to pick messages from each chosen scene. No excerpt could fit, so the request only added a possible hosted charge and up to 10 seconds before the reply (each recall pass has a 10-second limit). The receipt reason added in #7277/#7278 for that case also said "the summaries used all the memory space". That is not always true: a better scene's minimum excerpt, or one long message, can use the space too. In a local check with two recalled scenes, the first scene got a one-message excerpt and the second got none, and the receipt blamed the summaries. ## What changed - `packages/server/src/services/advanced-memory.ts`, Decision message pass only: - An excerpt always keeps its centre, which is one of the scene's shortlisted messages (the model's best pick, or the best text match). A scene where not one of those messages fits on its own in the room the summaries left can get no excerpt, so its messages are no longer sent to the model. - When that leaves no scene, the second request is skipped. Every other recall outcome is unchanged: the same scenes, excerpts, receipt reasons and diagnostics as before. - `excerptText` moved earlier so the check can use the exact excerpt cost; its body is unchanged. - `en.json`: `excerptNoRoom` now reads "Some recalled scenes have no message excerpt because not enough memory space was left. A higher Summary and recall budget can make room." - `docs/agents/memory.md`: one sentence in **Optional Decision model** about the skipped request. Translation follow-up: #7282. - `CHANGELOG.md`: new `[Unreleased]` entry. - No model prompt changed, so debug prompt logging is untouched. Behaviour matrix, run on `origin/staging` and on this branch with a fake Decision model (min 1, max 2 unless noted; solo, individual group with a hidden pick, scenes with private summary parts, merged group, min 3/max 5, min 0/max 2, min 0/max 0, constants near the budget, tight and roomy budgets, newcomers): every case recalled the same scenes and excerpts with the same reasons. The only difference is the new no-room case below. | Case | Before | After | | --- | --- | --- | | Two long summaries leave less room than any scene message | 2 scenes, 0 excerpts, `excerpt-no-room`, 2 Decision requests | Same result, 1 Decision request (scenes only) | | A short message still fits | Second request sent | Second request sent (it can still pick that message) | ## 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` Agent-run checks (for the reviewer to confirm, not a substitute for the boxes above): - `pnpm check` and `pnpm localization:check` passed. - All 15 `advanced-memory` regressions, `memory-recall` (5/5), `summary` (5/5), `roleplay-user-private-memory`, `native-export-memory` and `pnpm regression:prompt` passed. - `advanced-memory-decisions.regression.ts` only gains a new block; no existing check changed. Its "not asked about messages that cannot fit" assertion fails on `origin/staging` and passes here. - Local CodeRabbit was rate limited when this PR opened; its result will be posted as a comment. ### Manual verification notes - Manually verify in a Roleplay chat with Advanced Memory, **Use Decision model** and a Memory Decision connection on: lower **Summary and recall budget** until Peek Prompt shows scene summaries but no message excerpts, send a message, then open **Peek Prompt → Decision diagnostics → Advanced Memory activity** and check that the latest recall lists scene results but no message results, and says that some recalled scenes have no message excerpt. - Manually verify that the same chat with a larger **Summary and recall budget** still sends the second request and shows message excerpts. - Manually verify that the memory receipt for a scene without an excerpt reads "Some recalled scenes have no message excerpt because not enough memory space was left. A higher Summary and recall budget can make room." ## 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) Docs: `docs/agents/memory.md` and `CHANGELOG.md` updated; translation follow-up #7282. ## UI evidence (if applicable) Receipt wording change only; no layout change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:17 +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#7662
No description provided.