[GH-ISSUE #1777] [Issue]: Gacha Forge story memory stops for good when an already-summarized source changes #1748

Closed
opened 2026-11-07 16:36:24 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

If a source that story memory has already summarized changes its fingerprint, background memory stops for good. It never summarizes later chapters, and Retry does not help. Two chapters later every prompt falls back to the legacy history. That history is unbounded, so on most models generation then fails with context-too-large.

Found while investigating #1761. That issue's fix (gacha-forge 1.25.2) bounds the summaries sent while the overview is behind; it does not touch this stall.

Affected package

gacha-forge (1.25.1 and earlier; still present in 1.25.2)

Expected behavior

A changed source does not stop memory. Later canon keeps being summarized, the overview is rebuilt, and recall stays on the bounded memory path.

Actual behavior

  • maintainImpl returns stale / source-changed at the first source whose fingerprint differs from its saved record, and keeps the old record (packages/gacha-forge/src/story-memory.mjs, the existing.fingerprint !== source.fingerprint check in the source loop). This is deliberate: "first canonical records cannot be rewritten by replay" (tests/gacha-forge-story-memory.regression.mjs). But it returns before summarizing anything after that source.
  • recall() sets the overview aside, because one of its stamps no longer matches.
  • Once a chapter after the changed source has no summary, recall() returns stale and context() uses legacy(). Legacy holds every earlier chapter in full unless a manual Compress digest exists. In a probe with 42 chapters it came to 227,079 tokens; on a 32k model the route returned generation-failed / context-too-large.
  • The player sees "Couldn't write this scene" or "Generation needs more output space", and Retry repeats the failure.

Steps to reproduce

No gameplay path changes a completed source today. Completed chapters and Character Stories refuse regeneration, and a regeneration that resets an ongoing one clears the overview itself. The realistic triggers are:

  1. A package update that changes how canonical segments or source fields render. That would change every chapter's fingerprint, so every world would stall at its first chapter.
  2. Edited stored data.

Probe (scratch harness, real bundle routes): change the content of a covered Character Story, then play two more chapters. Memory stays stale / source-changed with an unchanged recordCount, and the next scene uses the legacy history.

Environment

  • Marinara Engine version: staging
  • Package version: gacha-forge 1.25.1
  • Install type: source
  • OS + version: macOS
  • Browser or app shell: n/a (server-side)

Logs, screenshots, or video

Bundle probe after a covered Character Story changed: memory "phase":"stale","reason":"source-changed"; two chapters later recordCount stays 41 and the chat route returns "error":"generation-failed","detail":"generation-output-capacity" at 32k.

Additional context

This needs a maintainer decision on policy:

  • (a) Keep the first-canon record and carry on. For a drifted key, memory keeps the archived record as canon: validRecords and the overview's stamp check accept it, and later sources keep being summarized. This matches the existing "first canon is never rewritten" rule and protects against replays. (Recommended.)
  • (b) Re-summarize the drifted source as new canon and rebuild the overview. This follows edits, but drops the replay protection.
  • Either way, also bound legacy(), so a memory failure degrades to a shorter history instead of a refused prompt.

Related: #1761, #1765.

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 27, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1777 Originally assigned to: @SpicyMarinara on GitHub. ## Summary If a source that story memory has already summarized changes its fingerprint, background memory stops for good. It never summarizes later chapters, and Retry does not help. Two chapters later every prompt falls back to the legacy history. That history is unbounded, so on most models generation then fails with `context-too-large`. Found while investigating #1761. That issue's fix (gacha-forge 1.25.2) bounds the summaries sent while the overview is behind; it does not touch this stall. ## Affected package `gacha-forge` (1.25.1 and earlier; still present in 1.25.2) ## Expected behavior A changed source does not stop memory. Later canon keeps being summarized, the overview is rebuilt, and recall stays on the bounded memory path. ## Actual behavior - `maintainImpl` returns `stale` / `source-changed` at the first source whose fingerprint differs from its saved record, and keeps the old record (`packages/gacha-forge/src/story-memory.mjs`, the `existing.fingerprint !== source.fingerprint` check in the source loop). This is deliberate: "first canonical records cannot be rewritten by replay" (`tests/gacha-forge-story-memory.regression.mjs`). But it returns before summarizing anything after that source. - `recall()` sets the overview aside, because one of its stamps no longer matches. - Once a chapter after the changed source has no summary, `recall()` returns `stale` and `context()` uses `legacy()`. Legacy holds every earlier chapter in full unless a manual Compress digest exists. In a probe with 42 chapters it came to 227,079 tokens; on a 32k model the route returned `generation-failed` / `context-too-large`. - The player sees "Couldn't write this scene" or "Generation needs more output space", and Retry repeats the failure. ## Steps to reproduce No gameplay path changes a completed source today. Completed chapters and Character Stories refuse regeneration, and a regeneration that resets an ongoing one clears the overview itself. The realistic triggers are: 1. A package update that changes how canonical segments or source fields render. That would change every chapter's fingerprint, so every world would stall at its first chapter. 2. Edited stored data. Probe (scratch harness, real bundle routes): change the content of a covered Character Story, then play two more chapters. Memory stays `stale` / `source-changed` with an unchanged `recordCount`, and the next scene uses the legacy history. ## Environment - Marinara Engine version: staging - Package version: gacha-forge 1.25.1 - Install type: source - OS + version: macOS - Browser or app shell: n/a (server-side) ## Logs, screenshots, or video Bundle probe after a covered Character Story changed: memory `"phase":"stale","reason":"source-changed"`; two chapters later `recordCount` stays 41 and the chat route returns `"error":"generation-failed","detail":"generation-output-capacity"` at 32k. ## Additional context This needs a maintainer decision on policy: - **(a) Keep the first-canon record and carry on.** For a drifted key, memory keeps the archived record as canon: `validRecords` and the overview's stamp check accept it, and later sources keep being summarized. This matches the existing "first canon is never rewritten" rule and protects against replays. (Recommended.) - **(b) Re-summarize the drifted source as new canon** and rebuild the overview. This follows edits, but drops the replay protection. - **Either way, also bound `legacy()`**, so a memory failure degrades to a shorter history instead of a refused prompt. Related: #1761, #1765. ## 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-11-07 16:36:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

SpicyMarinara chose option A: the first-saved record stays canon and memory carries on, and the legacy full-history fallback gets bounded too. Claude Code is adding this to #1778 (Gacha Forge 1.25.2).

<!-- gh-comment-id:6454957401 --> @SpicyMarinara commented on GitHub (Oct 27, 2026): SpicyMarinara chose option A: the first-saved record stays canon and memory carries on, and the legacy full-history fallback gets bounded too. Claude Code is adding this to #1778 (Gacha Forge 1.25.2).
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-Agents#1748
No description provided.