mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8841] [MERGED] fix(server): hold summarized Roleplay history to the recent message tail #8838
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8838
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8841
Author: @SpicyMarinara
Created: 11/4/2026
Status: ✅ Merged
Merged: 11/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/recent-tail-strict📝 Commits (2)
6cfa789fix(server): hold summarized Roleplay history to the recent message tailee4b5f2fix(server): keep messages whose summary the prompt leaves out📊 Changes
14 files changed (+730 additions, -23 deletions)
View changed files
📝
docs/agents/memory.md(+2 -0)📝
docs/chats/peek-prompt.md(+2 -0)➕
e2e/peek-prompt-current-context.e2e.ts(+81 -0)📝
e2e/summary-controls.e2e.ts(+125 -0)📝
packages/client/src/components/chat/ChatSummaryPanel.tsx(+17 -1)📝
packages/client/src/components/chat/PeekPromptModal.tsx(+49 -2)📝
packages/client/src/hooks/use-chats.ts(+21 -2)📝
packages/client/src/localization/locales/en.json(+6 -0)📝
packages/server/src/routes/chats.routes.ts(+33 -12)📝
packages/server/src/routes/generate.routes.ts(+6 -0)📝
packages/server/src/routes/generate/dry-run-route.ts(+6 -0)📝
packages/server/src/routes/generate/generate-route-utils.ts(+36 -0)📝
packages/server/src/services/generation/roleplay-summary-retrieval.ts(+29 -6)➕
scripts/regressions/summary-recent-tail.regression.ts(+317 -0)📄 Description
Linked issue
Closes #8831
Why this change
With Automatic Summaries and Hide summarised messages on, users set Recent message tail to 10 but Peek Prompt showed 12 to 24 history messages, and the count changed from turn to turn (#8831). Prompts got bigger and cost more than the setting suggests, and nothing said why. After this change the tail is a real cap on summarized messages. The prompt holds at most the tail plus any older messages no summary covers yet. Chat Summary counts those messages instead of letting them exceed the tail silently. Peek Prompt now says that a saved request comes from before that turn's summary, and can show the context as it is now.
What changed
capSummarizedHistoryinpackages/server/src/routes/generate/generate-route-utils.ts. When Hide summarised messages is on, it drops any message an enabled summary entry covers once that message is older than the newestsummaryTailMessagesmessages. It keeps a covered message the user un-hid by hand (visibilityManual). It keeps older messages no entry covers and returns how many there are asbacklog. A message covered only by a turned-off entry is kept but not counted, which matches what Backfill Summary skips.generate.routes.ts, only without Advanced Memory), the dry-run preview (dry-run-route.ts) and Peek Prompt's live assembly (chats.routes.ts) now pass history throughcapSummarizedHistory, after hidden-message filtering and before the context message limit. Summary selection still reads all stored messages, so it is unaffected.GET /api/chats/:id/summary-backlog. It returns the backlog count for the history the next Roleplay prompt would start from, and 0 for other modes or when Advanced Memory is on.POST /api/chats/:id/peek-promptaccepts{ current: true }. This skips the saved request and builds the live preview now. In that case the four live-preview return paths no longer claim that "No saved model request was available" (they share onelivePreviewNote).ui.chat.summarypopover.summaryBacklog). It comes from a newuseSummaryBacklogquery underchatKeys.summaryBacklog(nested under the messages key, so transcript refreshes update it), keyed by the tail and each entry's id, enabled state and message count.current: trueand back. Reply checkup is hidden in the current view, and running a Decision test goes back to the sent request.docs/agents/memory.md(how the tail caps summarized messages, the backlog note, Backfill Summary) anddocs/chats/peek-prompt.md(sent request vs current context). Translation follow-up is the existing issue #8835[docs-i18n] docs/agents/memory.md, docs/chats/peek-prompt.md, opened by the earlier attempt with this same content, so I reused it instead of opening a duplicate.scripts/regressions/summary-recent-tail.regression.tsdrives real generations against a fake provider through the issue's scenario. It checks the history counts sent per turn ([65, 26, 26, 26, 10, 10]), the backlog after each turn ([16, 16, 16, 0, 0, 0]), the saved vs current Peek Prompt and the dry-run preview, plus unit cases for the helper (hiding off, disabled entry, tail 0, manual un-hide, disabled-entry backlog). Newe2e/peek-prompt-current-context.e2e.tsand a new backlog test ine2e/summary-controls.e2e.ts.Validation
pnpm checkpasses locallyManual verification notes
Agent-run checks (for reference):
Independent review of
6cfa78983a: 3 findings. Two fixed inee4b5f2239(a swipe or retrieval could drop messages whose summary the prompt leaves out; the backlog note could show a stale 0 right after turning hiding on). One not changed at the maintainer's direction (the backlog note does not apply the removed context message limit). Dottore Review: Viable, With Notes, no defects.Known limits and risks:
summaryContextSizemessages on a first run (selectRollingSummaryMessagesis unchanged). A large uncovered backlog is not summarized oldest-first automatically. It shrinks over later runs or through Backfill Summary, and the new note in Chat Summary shows its size until then.{{prompt}}after a summary already fell back to a live preview through the summary fingerprint check.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.