[PR #7351] [MERGED] fix(memory): decide your own message when you post it #7695

Closed
opened 2026-10-24 04:06:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7351
Author: @SpicyMarinara
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/7349-user-message-visibility


📝 Commits (4)

  • bdf5cee fix(memory): decide your own message when you post it (#7349)
  • 4812da2 Merge origin/staging into fix/7349-user-message-visibility
  • d016335 Move the CHANGELOG entry away from other open PRs
  • b3c6648 fix(memory): show the decision on an impersonated message right away (#7349)

📊 Changes

5 files changed (+128 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/memory.md (+1 -1)
📝 packages/server/src/routes/chats.routes.ts (+11 -2)
📝 packages/server/src/routes/generate.routes.ts (+16 -1)
📝 scripts/regressions/advanced-memory-visibility.regression.ts (+99 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7349

Why this change

  • With Decide who sees new messages on in a Roleplay group chat where characters reply one by one, your own message did not look decided when you sent it. Mari: "It should trigger once when we send the message in a group chat."
  • Reproduced on staging, there were three causes:
    • A message posted without a reply (Manual response order, Post only, /send) goes through POST /api/chats/:id/messages, which never ran the visibility step. The message stayed undecided until a later reply was requested.
    • A message written by Impersonate is saved after the visibility step of that request, and the post-reply check skips impersonation, so it also waited for the next reply.
    • On a normal send the server did decide the message before the first character replied, but the client had already received the user row (message_saved) before the decision, and only learned the result in the end-of-turn refresh. The crossed-eye marker showed up only after every character had replied.

What changed

  • POST /api/chats/:id/messages: a user message in a Roleplay chat with Advanced Memory and Decide who sees new messages on is decided right away, and the response carries the decided row. A failed decision is logged and hides nothing, and the message is still returned. Character, narrator and system messages posted this way are unchanged.
  • Generate route: after the visibility pass that runs before the first reply, the decided user row is sent again as message_saved, so the marker shows on your message before any character replies.
  • Impersonate: the saved persona message is decided once after it is posted, in the same background slot the post-reply scene check uses, and the decided row is sent again as message_saved, so the marker does not wait for the request's other background work (such as an illustration) to finish.
  • Decisions still go through the existing per-chat visibility queue and visibilitySettled, so each message is decided once, a manual Hide from AI choice still wins, and a following reply waits for a decision in progress.
  • Regression: scripts/regressions/advanced-memory-visibility.regression.ts now covers a send (marker reaches the client before the first reply, decided once), a post without a reply (decided in the response, not asked again, no call for a hand-written character line or with the toggle off), and Impersonate. It fails on current staging.
  • docs/agents/memory.md: one sentence saying your own message is decided as soon as you post it. Translations: #7350.
  • CHANGELOG.md: one entry under Unreleased.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks: node ./scripts/run-regressions.mjs --filter scripts/regressions/advanced-memory-visibility.regression.ts passes, and fails on staging without the fix (each of the three code changes reverted on its own also fails it). pnpm check (through the shared slot limiter) and pnpm regression:prompt pass. The neighbouring advanced-memory-generation, advanced-memory-post-generation, advanced-memory-core and advanced-memory-decisions regressions pass. Local CodeRabbit (--committed) gave one minor finding, not applied: it suggests scoping the settle after a post to the new message only, so a second message posted while the first is still queued is not in the same model call. The batching it describes is the existing design of settleMessageVisibility (a generation's settle and the post-reply check already decide every undecided recent message in one call with the window as context), the overlap needs the first post's pass to be queued behind another visibility pass, and the extra context can only lean toward keeping a message visible.

Manual verification notes

  • Manually verify in a Roleplay group chat (characters reply one by one, Advanced Memory Recall on, Decide who sees new messages on, Sequential order): have one character leave the scene, send a message, and check that the crossed-eye marker on your message names the absent character before the first character finishes replying.
  • Manually verify with Manual response order: send a message and check that it appears already marked, without picking a character to reply.
  • Manually verify Post only and /send in the same chat mark the message when it appears.
  • Manually verify Impersonate marks the written message once the request finishes.
  • Manually verify that unhiding your message with Hide from AI stays unhidden after the next reply, and that regenerating a reply does not re-decide your message.
  • Manually verify that posting with the toggle off, or in a merged group chat, makes no extra Helper or Decision call (server log with debug on).
  • Note for review: a message posted without a reply (Manual order, Post only, /send, and the partial message kept when you stop an Impersonate) now appears only after the decision returns. That is usually a second or two with a fast Helper, up to the 20-second visibility timeout, plus any visibility pass already running for the chat, such as a due post-reply scene check, which has no timeout of its own. Stopping an Impersonate keeps the composer busy for that time. Showing the message right away would need an optimistic row on the client; left as a maintainer decision.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI code changed. The existing per-character Hide from AI marker now appears on your message earlier.

Summary by CodeRabbit

  • New Features
    • In Roleplay group chats with Advanced Memory automatic visibility enabled, visibility decisions for user messages are made immediately after posting, even if no character replies.
    • The Hide from AI marker appears as soon as the decision is made. Impersonated messages are evaluated as well.
  • Bug Fixes
    • Ensured each message receives a visibility decision only once.
  • Documentation
    • Updated guidance to explain when user messages are evaluated.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7351 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/7349-user-message-visibility` --- ### 📝 Commits (4) - [`bdf5cee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bdf5cee035a109792442eac7f74d2b9632011421) fix(memory): decide your own message when you post it (#7349) - [`4812da2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4812da20d3981af9c155cfd999b85533aa7e65cd) Merge origin/staging into fix/7349-user-message-visibility - [`d016335`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d016335a33ee869196f42d242aa32e21deb67429) Move the CHANGELOG entry away from other open PRs - [`b3c6648`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b3c664829e2f753985bb46b955b134f356310372) fix(memory): show the decision on an impersonated message right away (#7349) ### 📊 Changes **5 files changed** (+128 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/memory.md` (+1 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+11 -2) 📝 `packages/server/src/routes/generate.routes.ts` (+16 -1) 📝 `scripts/regressions/advanced-memory-visibility.regression.ts` (+99 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7349 ## Why this change - With **Decide who sees new messages** on in a Roleplay group chat where characters reply one by one, your own message did not look decided when you sent it. Mari: "It should trigger once when we send the message in a group chat." - Reproduced on staging, there were three causes: - A message posted without a reply (**Manual** response order, **Post only**, `/send`) goes through `POST /api/chats/:id/messages`, which never ran the visibility step. The message stayed undecided until a later reply was requested. - A message written by **Impersonate** is saved after the visibility step of that request, and the post-reply check skips impersonation, so it also waited for the next reply. - On a normal send the server did decide the message before the first character replied, but the client had already received the user row (`message_saved`) before the decision, and only learned the result in the end-of-turn refresh. The crossed-eye marker showed up only after every character had replied. ## What changed - `POST /api/chats/:id/messages`: a user message in a Roleplay chat with Advanced Memory and **Decide who sees new messages** on is decided right away, and the response carries the decided row. A failed decision is logged and hides nothing, and the message is still returned. Character, narrator and system messages posted this way are unchanged. - Generate route: after the visibility pass that runs before the first reply, the decided user row is sent again as `message_saved`, so the marker shows on your message before any character replies. - Impersonate: the saved persona message is decided once after it is posted, in the same background slot the post-reply scene check uses, and the decided row is sent again as `message_saved`, so the marker does not wait for the request's other background work (such as an illustration) to finish. - Decisions still go through the existing per-chat visibility queue and `visibilitySettled`, so each message is decided once, a manual **Hide from AI** choice still wins, and a following reply waits for a decision in progress. - Regression: `scripts/regressions/advanced-memory-visibility.regression.ts` now covers a send (marker reaches the client before the first reply, decided once), a post without a reply (decided in the response, not asked again, no call for a hand-written character line or with the toggle off), and Impersonate. It fails on current staging. - `docs/agents/memory.md`: one sentence saying your own message is decided as soon as you post it. Translations: #7350. - `CHANGELOG.md`: one entry under Unreleased. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks: `node ./scripts/run-regressions.mjs --filter scripts/regressions/advanced-memory-visibility.regression.ts` passes, and fails on staging without the fix (each of the three code changes reverted on its own also fails it). `pnpm check` (through the shared slot limiter) and `pnpm regression:prompt` pass. The neighbouring `advanced-memory-generation`, `advanced-memory-post-generation`, `advanced-memory-core` and `advanced-memory-decisions` regressions pass. Local CodeRabbit (`--committed`) gave one minor finding, not applied: it suggests scoping the settle after a post to the new message only, so a second message posted while the first is still queued is not in the same model call. The batching it describes is the existing design of `settleMessageVisibility` (a generation's settle and the post-reply check already decide every undecided recent message in one call with the window as context), the overlap needs the first post's pass to be queued behind another visibility pass, and the extra context can only lean toward keeping a message visible. ### Manual verification notes - Manually verify in a Roleplay group chat (characters reply one by one, Advanced Memory Recall on, **Decide who sees new messages** on, Sequential order): have one character leave the scene, send a message, and check that the crossed-eye marker on your message names the absent character before the first character finishes replying. - Manually verify with **Manual** response order: send a message and check that it appears already marked, without picking a character to reply. - Manually verify **Post only** and `/send` in the same chat mark the message when it appears. - Manually verify **Impersonate** marks the written message once the request finishes. - Manually verify that unhiding your message with **Hide from AI** stays unhidden after the next reply, and that regenerating a reply does not re-decide your message. - Manually verify that posting with the toggle off, or in a merged group chat, makes no extra Helper or Decision call (server log with debug on). - Note for review: a message posted without a reply (Manual order, **Post only**, `/send`, and the partial message kept when you stop an Impersonate) now appears only after the decision returns. That is usually a second or two with a fast Helper, up to the 20-second visibility timeout, plus any visibility pass already running for the chat, such as a due post-reply scene check, which has no timeout of its own. Stopping an Impersonate keeps the composer busy for that time. Showing the message right away would need an optimistic row on the client; left as a maintainer decision. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI code changed. The existing per-character **Hide from AI** marker now appears on your message earlier. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * In Roleplay group chats with Advanced Memory automatic visibility enabled, visibility decisions for user messages are made immediately after posting, even if no character replies. * The **Hide from AI** marker appears as soon as the decision is made. Impersonated messages are evaluated as well. * **Bug Fixes** * Ensured each message receives a visibility decision only once. * **Documentation** * Updated guidance to explain when user messages are evaluated. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:37 +07:00
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#7695
No description provided.