[GH-ISSUE #3123] [Issue]: automatic roleplay chat summary runs on the first user post/reply #1676

Closed
opened 2026-10-21 05:41:36 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @calmcacil on GitHub (Jul 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3123

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Automatic roleplay/visual novel chat summaries can run on the first eligible user post/reply instead of waiting for the configured summary interval. This happens because a missing or stale lastAutomaticSummaryMessageId is treated as infinite messages since the last summary.

Expected behavior

Automatic summaries should wait until the configured summaryRunInterval worth of user messages has actually occurred before generating the first rolling summary.

Actual behavior

On a fresh chat, or when lastAutomaticSummaryMessageId is missing/invalid, the first eligible assistant reply can immediately trigger an automatic summary. This creates a low-value summary of messages that are already still in active context and wastes a provider call.

Steps to reproduce

  1. Create or open a roleplay/visual novel chat with automatic chat summaries enabled.
  2. Ensure the chat has no valid lastAutomaticSummaryMessageId, such as a fresh chat or migrated/old metadata.
  3. Send the first user message and let the assistant reply.
  4. Observe that an automatic rolling summary can be generated immediately instead of waiting for the configured interval.

Environment

  • Marinara Engine version: 2.0.8
  • Install type: docker
  • OS + version: Linux
  • Browser or app shell: Chromium

Logs, screenshots, or video

Relevant code path:

  • packages/server/src/routes/generate.routes.ts
  • countUserMessagesAfterAnchor() returns Number.POSITIVE_INFINITY when anchorMessageId is missing or not found.
  • runAutomaticRoleplaySummary() compares that value to summaryRunInterval, so the first run passes cadence immediately.

Additional context

Likely fix: when there is no valid summary anchor, count actual user messages in the chat instead of returning Infinity.

Suggested regression coverage:

  1. Fresh roleplay chat with auto-summary enabled and default interval does not summarize after the first exchange.
  2. Auto-summary runs only after summaryRunInterval user messages.
  3. Stale/invalid lastAutomaticSummaryMessageId does not force an immediate summary on the next reply.

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 @calmcacil on GitHub (Jul 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3123 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Automatic roleplay/visual novel chat summaries can run on the first eligible user post/reply instead of waiting for the configured summary interval. This happens because a missing or stale `lastAutomaticSummaryMessageId` is treated as infinite messages since the last summary. ## Expected behavior Automatic summaries should wait until the configured `summaryRunInterval` worth of user messages has actually occurred before generating the first rolling summary. ## Actual behavior On a fresh chat, or when `lastAutomaticSummaryMessageId` is missing/invalid, the first eligible assistant reply can immediately trigger an automatic summary. This creates a low-value summary of messages that are already still in active context and wastes a provider call. ## Steps to reproduce 1. Create or open a roleplay/visual novel chat with automatic chat summaries enabled. 2. Ensure the chat has no valid `lastAutomaticSummaryMessageId`, such as a fresh chat or migrated/old metadata. 3. Send the first user message and let the assistant reply. 4. Observe that an automatic rolling summary can be generated immediately instead of waiting for the configured interval. ## Environment - Marinara Engine version: 2.0.8 - Install type: docker - OS + version: Linux - Browser or app shell: Chromium ## Logs, screenshots, or video Relevant code path: - `packages/server/src/routes/generate.routes.ts` - `countUserMessagesAfterAnchor()` returns `Number.POSITIVE_INFINITY` when `anchorMessageId` is missing or not found. - `runAutomaticRoleplaySummary()` compares that value to `summaryRunInterval`, so the first run passes cadence immediately. ## Additional context Likely fix: when there is no valid summary anchor, count actual user messages in the chat instead of returning `Infinity`. Suggested regression coverage: 1. Fresh roleplay chat with auto-summary enabled and default interval does not summarize after the first exchange. 2. Auto-summary runs only after `summaryRunInterval` user messages. 3. Stale/invalid `lastAutomaticSummaryMessageId` does not force an immediate summary on the next reply. ## 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 05:41:36 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@SpicyMarinara commented on GitHub (Jul 2, 2026):

Codex is taking this in branch codex/issue-sweep-3119-3135 for a staging-targeted fix sweep.

<!-- gh-comment-id:4864509722 --> @SpicyMarinara commented on GitHub (Jul 2, 2026): Codex is taking this in branch codex/issue-sweep-3119-3135 for a staging-targeted fix sweep.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 2, 2026):

Fix is ready in PR #3138 with CI passing. This issue will close automatically when the PR merges into staging.

<!-- gh-comment-id:4864746205 --> @SpicyMarinara commented on GitHub (Jul 2, 2026): Fix is ready in PR #3138 with CI passing. This issue will close automatically when the PR merges into staging.
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#1676
No description provided.