[GH-ISSUE #7250] [Issue]: Advanced Memory adds a bare range header for summaries that render empty for the reader #4045

Closed
opened 2026-10-21 06:09:49 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @SpicyMarinara on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7250

Originally assigned to: @SpicyMarinara on GitHub.

Summary

In Advanced Memory, a Chat Summary entry whose conditional sections all render to empty text for the reader still puts its range header in the prompt: Messages #a–#b; source timeframe (summary corrections take precedence): … with nothing under it. This happens in Individual and merged group chats, and in one-character chats. The empty header also counts against the memory budget.

The builder of #7239 found this while fixing #7237: a character who joins a group later gets a bare header for every summary the earlier cast wrote for themselves.

Expected behavior

An entry that renders to nothing for the reader is left out completely: no range header, no tokens counted, in the prompt sent to the model, in Peek Prompt and in the preparation receipt. Entries with any content are unchanged.

Actual behavior

The entry keeps its header. Example from an Individual group chat, reading as Cara, who joined after Maukie and Pantalone wrote a shared summary scoped to themselves:

Messages #3–#4; source timeframe (summary corrections take precedence): unknown (use message order).


Messages #1–#2; source timeframe (summary corrections take precedence): unknown (use message order).
CONST_PLAIN The compass promise.

The first header has no text under it. Cara cannot read that entry, so it should not appear at all.

Steps to reproduce

  1. Open a Roleplay group chat (Individual or merged) with Advanced Memory ready and a closed scene outside the live history.
  2. Add a Chat Summary entry for that scene's messages whose whole text is a condition for someone not in the reply, for example {{#if char == "Narrator"}}Only the narrator knows this.{{/if}}, or let a character join after summaries scoped to the earlier cast exist.
  3. Open Peek Prompt for a reply by another character. The Chat Summary block shows Messages #…; source timeframe … with nothing under it.

Environment

  • Marinara Engine version: staging at 10bdad166 (after #7239)
  • Install type: source
  • OS + version: macOS 26
  • Browser or app shell: any (server-side prompt text)

Logs, screenshots, or video

Reproduced in scripts/regressions/advanced-memory-audience.regression.ts: Cara's Individual recall on staging returns the bare Messages #3–#4 header shown above.

Additional context

  • Found by the #7239 builder while fixing #7237.
  • Code: prepareImpl in packages/server/src/services/advanced-memory.ts adds renderMemoryText(...) whenever the entry covers messages, even when renderEntry(...) returned empty text.
  • Related: #7237, #7239.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7250 Originally assigned to: @SpicyMarinara on GitHub. ## Summary In Advanced Memory, a Chat Summary entry whose conditional sections all render to empty text for the reader still puts its range header in the prompt: `Messages #a–#b; source timeframe (summary corrections take precedence): …` with nothing under it. This happens in Individual and merged group chats, and in one-character chats. The empty header also counts against the memory budget. The builder of #7239 found this while fixing #7237: a character who joins a group later gets a bare header for every summary the earlier cast wrote for themselves. ## Expected behavior An entry that renders to nothing for the reader is left out completely: no range header, no tokens counted, in the prompt sent to the model, in Peek Prompt and in the preparation receipt. Entries with any content are unchanged. ## Actual behavior The entry keeps its header. Example from an Individual group chat, reading as Cara, who joined after Maukie and Pantalone wrote a shared summary scoped to themselves: ```text Messages #3–#4; source timeframe (summary corrections take precedence): unknown (use message order). Messages #1–#2; source timeframe (summary corrections take precedence): unknown (use message order). CONST_PLAIN The compass promise. ``` The first header has no text under it. Cara cannot read that entry, so it should not appear at all. ## Steps to reproduce 1. Open a Roleplay group chat (Individual or merged) with Advanced Memory ready and a closed scene outside the live history. 2. Add a Chat Summary entry for that scene's messages whose whole text is a condition for someone not in the reply, for example `{{#if char == "Narrator"}}Only the narrator knows this.{{/if}}`, or let a character join after summaries scoped to the earlier cast exist. 3. Open Peek Prompt for a reply by another character. The Chat Summary block shows `Messages #…; source timeframe …` with nothing under it. ## Environment - Marinara Engine version: staging at 10bdad166 (after #7239) - Install type: source - OS + version: macOS 26 - Browser or app shell: any (server-side prompt text) ## Logs, screenshots, or video Reproduced in `scripts/regressions/advanced-memory-audience.regression.ts`: Cara's Individual recall on staging returns the bare `Messages #3–#4` header shown above. ## Additional context - Found by the #7239 builder while fixing #7237. - Code: `prepareImpl` in `packages/server/src/services/advanced-memory.ts` adds `renderMemoryText(...)` whenever the entry covers messages, even when `renderEntry(...)` returned empty text. - Related: #7237, #7239. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:09:49 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@SpicyMarinara commented on GitHub (Oct 7, 2026):

Fix in #7255. One exception, on purpose: when the entry's messages have a known story date, the dated range line stays. Since fd8f408d4, scene dates are shared with every participant, and advanced-memory-summary.regression.ts asserts that every reader's Chat Summary includes that date. Only headers with an unknown timeframe and nothing under them are removed.

<!-- gh-comment-id:6038957924 --> @SpicyMarinara commented on GitHub (Oct 7, 2026): Fix in #7255. One exception, on purpose: when the entry's messages have a known story date, the dated range line stays. Since fd8f408d4, scene dates are shared with every participant, and `advanced-memory-summary.regression.ts` asserts that every reader's Chat Summary includes that date. Only headers with an unknown timeframe and nothing under them are removed.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 7, 2026):

Fixed on staging by #7255. Ships to main with the next promotion.

<!-- gh-comment-id:6039440693 --> @SpicyMarinara commented on GitHub (Oct 7, 2026): Fixed on `staging` by #7255. Ships to `main` with the next promotion.
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#4045
No description provided.