mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7199] [MERGED] feat(memory): let Advanced Memory decide who sees new messages in group chats #7621
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#7621
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/7199
Author: @SpicyMarinara
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/auto-message-visibility-7192📝 Commits (10+)
4a26df4feat(memory): let Advanced Memory decide who sees new messages in group chats9aeae74test(memory): capture the visibility switch in light and dark themesd613f1efix(memory): keep Jev scene checks when shared presence answers failfd9f64cMerge remote-tracking branch 'origin/staging' into feat/auto-message-visibility-719295056b4docs(memory): keep the visibility note apart from Hide from AI's chooser text16e7dcbMerge remote-tracking branch 'origin/staging' into feat/auto-message-visibility-71925d7d04ddocs(memory): name the Roleplay Commands narrator by its labelac42fd8fix(memory): keep /unhide choices and scene checks safe from automatic visibility2d1e443fix(memory): retry the scene check alone only for an unusable shared answer49b0ee9Merge remote-tracking branch 'origin/staging' into feat/auto-message-visibility-7192📊 Changes
14 files changed (+1102 additions, -98 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/agents/memory.md(+12 -0)📝
docs/chats/messages.md(+2 -0)📝
e2e/advanced-memory.e2e.ts(+62 -0)📝
packages/client/src/components/chat/AdvancedMemorySettings.tsx(+12 -0)📝
packages/client/src/localization/locales/en.json(+2 -0)📝
packages/server/src/routes/chats.routes.ts(+11 -1)📝
packages/server/src/routes/generate.routes.ts(+33 -2)📝
packages/server/src/services/advanced-memory-decisions.ts(+58 -9)📝
packages/server/src/services/advanced-memory.ts(+446 -83)📝
packages/server/src/services/storage/chats.storage.ts(+11 -3)📝
packages/shared/src/types/advanced-memory.ts(+2 -0)📝
packages/shared/src/types/chat.ts(+4 -0)➕
scripts/regressions/advanced-memory-visibility.regression.ts(+446 -0)📄 Description
Linked issue
Closes #7192
Why this change
What changed
autoMessageVisibilityin Advanced Memory settings (default off; older saved settings stay valid). The Decide who sees new messages switch appears only in Roleplay group chats in individual mode; the server ignores it in merged mode and one-character chats. It is excluded from the preparation policy hash, so turning it on or off doesn't invalidate saved memory snapshots.askMixedrequest if they fit the batch and state limits; otherwise they go in their own request. If the shared request's presence answers are unusable, the scene-end questions are retried alone, so the scene check never falls back to the helper because of presence. Without a Decision model, the Advanced Memory helper answers inside its due scene-check call ({"ends":[...],"visibility":[...]}), or in a separate call when no scene check is due or the check was batched with a tracker. If that shared answer comes back cut off, incomplete or without usableends, the scene check is asked again on its own (nothing is hidden for those messages); a connection error is not retried, so a broken helper isn't waited on twice. Helper names are mapped case-insensitively with a unique first-name fallback; omitted or unknown names hide nothing.hiddenFromAICharacterIdson the message and all swipes, so the normal crossed-eye marker shows them.extra.autoVisibilityrecords the decision; each message is decided once. The existing message-extra route marks any user change tohiddenFromAICharacterIdsasvisibilityManual, and so does thebulk-hiddenroute behind/hideand/unhide; automation never touches such a message, nor one that already had a hide, nor a message hidden from all. Both keys survive new swipes.ponytail:shortcut: on staging today a hidden message drops its whispers, so this keeps whispers working regardless of merge order. Once #7196 (#7191) lands, it can be removed so an absent recipient gets only the whisper. The #7191 whisper logic itself is untouched./generatesettles undecided recent messages (last 8, 20-second limit) before loading history, and again between replies of the same individual-mode turn, so no character generates before earlier messages are decided. The post-reply check decides the turn's last reply before any scene summary starts.askHelperJsonwithlogDebugOverride(debugMode /DEBUG_AGENTS); Decision requests use the backend's existing debug logging, plus a debug line with the decided hides.helperBudget/askHelperJsonhelpers (same prompts, limits, errors and debug text).docs/agents/memory.md(new Deciding who sees new messages section),docs/chats/messages.md(Hide from AI). CHANGELOG entry added. Translations: #7202.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks (not a substitute for the boxes above):
pnpm checkstages: impeccable, localization, format, lint, e2e types, token-estimation types and build all pass.scripts/regressions/advanced-memory-visibility.regression.ts(fake helper + fake Decision backend; narrator, Maukie present, Pantalone away, persona P): hides from Pantalone only; never the narrator or author; first-name and upper-case helper answers map correctly; swipes stay in sync; decided messages are not asked again; manual changes before and after automation persist; a pre-existing hide is left alone; a failed call hides nothing; toggle off, merged mode and one-character chats make no call; the helper answers presence inside a due scene check; the Decision model gets presence and scene-end questions in one request, or presence alone when no check is due; through/generate, visibility settles before each character in the turn and Pantalone's prompt lacks the earlier lines while the narrator's has them. Mutation-checked: removing either route guard fails the regression.e2e/advanced-memory.e2e.ts: the switch shows and saves in an individual group chat, and is absent in merged mode and in a one-character chat. Passed ondesktop-chromiumandmobile-chromium; the existing Decision-connection e2e next to it still passes.advanced-memory-*,slash-command-usage,regeneration-context,roleplay-whisper-generation,prompt*,past-reasoning-history,prompt-controls,decision-conditionals,smart-group-decision.Local CodeRabbit review (first pass, 3 findings):
withVisibility.Adversarial verification pass (separate agent, commits
ac42fd87a,2d1e4437d, staging merge49b0ee997):/hidethen/unhide(thebulk-hiddenroute) didn't count as the user's choice, so automation could later hide a message the user had just restored for everyone. The route now savesvisibilityManuallike the Hide from AI button (bulkSetHiddenFromAItakes optional extra fields; automatic summary hides are unchanged).endsfailed the whole scene check ("The scene helper returned an invalid scene decision"), so turning the switch on could break a scene check that would otherwise pass. It now retries the scene check alone, matching the Decision path. A connection error still fails as before.POST …/swipesand/generateregenerate) keep the decision and the manual flag; regenerations make no new visibility call; paused memory, Conversation mode, merged and one-character chats make no call; Stop during the start-of-generation check writes nothing and ends cleanly; a hung helper times out at 20 s and the reply goes ahead with nothing hidden; prompt preview (/generate/dryRun) stays read-only and never decides visibility.pnpm checkpasses (includinglocalization:check),pnpm regression:promptpasses, all 13advanced-memory-*regressions plusroleplay-whisper-generation,roleplay-commands,slash-command-usage,regeneration-context,command-only-regenerate,roleplay-interrupt-generation,chat-story-export,past-reasoning-history,prompt-controls,decision-conditionals,smart-group-decision,spatial-only-message-visibilityandissue-sweep-5391-5394pass. The visibility e2e and the Decision-connection e2e pass ondesktop-chromiumandmobile-chromium(the Decision-connection e2e timed out once while the machine was loaded and passed on both reruns).Local CodeRabbit on the final head (after two rate-limit waits), 3 findings, none changed:
visibilityManualvalues whenbulkSetHiddenFromAIrolls back". A rollback can leavevisibilityManualon some rows the user tried to change; that only stops automation for those messages, so they stay visible to every character (the same result as a failed decision). The method's all-or-nothing contract covershiddenFromAI, which callers record as ownership, and that is still restored.plan.askedfalse after an unusable shared answer so visibility gets its own call". Each message is decided once and a failure hides nothing; a third call would hold the next reply longer.hiddenFromAI, and the refresh only applies automatic per-character results; a user hiding a reply for everyone in the middle of a turn behaves exactly as on staging (and with the switch off). Changing that is a separate behavior change.Manual verification notes
/hide Nthen/unhide Non a new message before the next reply, and confirm no character is hidden from it afterwards.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
docs/agents/memory.md,docs/chats/messages.md,CHANGELOG.md.UI evidence (if applicable)
New switch under Narrator in Advanced Memory settings. The new e2e saves
memory-message-visibility-on-light.pngand-dark.pngin its test output.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.