[PR #7389] [MERGED] fix(roleplay): leave whisper-only messages out for characters they don't reach #7712

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

📋 Pull Request Information

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

Base: staging ← Head: fix/whisper-only-hidden-from-others


📝 Commits (4)

  • 79ad435 fix(roleplay): leave whisper-only messages out for characters they don't reach
  • 55aedcc fix(roleplay): keep documents, shared notes and prefills when hiding a whisper-only message
  • 6af16c3 perf(roleplay): check only the latest user turn for a whisper-only input
  • 3799040 Merge remote-tracking branch 'origin/staging' into fix/whisper-only-hidden-from-others

📊 Changes

6 files changed (+143 additions, -24 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+4 -1)
📝 packages/server/src/routes/generate/dry-run-route.ts (+9 -2)
📝 packages/server/src/services/generation/prompt-message-scope.ts (+19 -0)
📝 packages/server/src/services/generation/roleplay-commands.ts (+45 -21)
📝 scripts/regressions/roleplay-user-private-generation.regression.ts (+65 -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 #7388

Why this change

  • In Roleplay, a message that is only a whisper (for example [whisper: character="Maukie" text="..."]) showed as Mari: [Private whisper] in every other character's prompt. That told the other characters the persona was there and talking, which spoils scenes such as sneaking up on someone. Mari reported this right after #7381, which made the same placeholder appear with Advanced Memory on too.
  • conversationPromptHistoryContent renders a whisper-only message as the [Private whisper] placeholder so appendRoleplayWhispers has a message to attach the whisper to. Nothing removed it for characters who get no whisper from it.

What changed

  • appendRoleplayWhispers (roleplay-commands) first drops whisper-only messages (roleplayWhisperOnlyMessageIds) that deliver no whisper to this viewer, then inserts whisper text as before. The recipient and the appointed narrator keep the message. With no private viewer, as in merged group chats, nobody gets it. The live request and Peek Prompt both run this step.
  • dropPromptHistoryMessages (prompt-message-scope) removes history messages in place and moves the <chat_history> / <last_message> wrappers (and the Markdown equivalents) to what is left, using the existing reassignHistoryLastMessageWrapper. It removes only history entries left empty, so a reasoning-only assistant prefill stays. Dropping happens before any whisper text is inserted, so re-wrapping never meets whisper fragments.
  • A message is whisper-only only when it has no text, attachment or document. A reply that is a whisper plus a public [document] stays visible to everyone; only its whisper is private.
  • A private note the user shared with a character on a whisper-only message keeps that message in the character's prompt, so the note still arrives.
  • {{input}}, memory-recall queries and the Illustrator's prompt text get no text from a whisper-only turn (latestRoleplayUserInput), live and in Peek Prompt. Before, they got [Private whisper].
  • Not changed: speaker selection and agents still see the message as [Private whisper] (never the text). They aren't characters, and Smart order can use the signal that someone whispered. Say if agents should drop it too.
  • Regression (roleplay-user-private-generation): a whisper-only message to Bob. Alice's Peek Prompt (also when impersonating) and live request contain neither the secret nor [Private whisper, with the last message and chat history each wrapped once, both while the whisper is the latest message and after a later reply. Bob and the narrator still receive it. Fails on staging with "no trace for others". Further cases: a shared note, a public document, {{input}}, and an empty reasoning prefill. Each fails without its own fix.

Review

  • Local CodeRabbit (3 runs): one finding, the cost of rescanning history for {{input}}. Fixed.
  • Adversarial review (2 lenses, 2 skeptics per finding): the document, shared-note and prefill problems above were confirmed and fixed. Refuted: {{input}} (no worse than staging, fixed anyway because it is the same exposure) and continuing a character's whisper-only reply (intended).

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

Commands run by the agent: pnpm check; node ./scripts/run-regressions.mjs --filter for roleplay-user-private-generation, roleplay-whisper-hidden-recipient, roleplay-whisper-generation, roleplay-user-private-storage, roleplay-user-private-memory, roleplay-commands, roleplay-interrupt-generation, advanced-memory-visibility, advanced-memory-generation, advanced-memory-context and prompt (all pass).

Manual verification notes

  • Manually verify in a Roleplay group chat: send only [whisper: character="<name>" text="..."], then open Peek Prompt for another character and check the message is not there at all.
  • Manually verify the recipient's and the narrator's Peek Prompt still show it with the whisper.

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)

CHANGELOG [Unreleased] has an entry. No user docs change.


🔄 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/7389 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/whisper-only-hidden-from-others` --- ### 📝 Commits (4) - [`79ad435`](https://github.com/Pasta-Devs/Marinara-Engine/commit/79ad4356d77f5743ff6f29dadf13ec9eab26faea) fix(roleplay): leave whisper-only messages out for characters they don't reach - [`55aedcc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/55aedcc2b0ef3ef8781a009c8e29a1abcd8a5fb5) fix(roleplay): keep documents, shared notes and prefills when hiding a whisper-only message - [`6af16c3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6af16c33f8804a2489e5c029fa5e9dd1406cab3f) perf(roleplay): check only the latest user turn for a whisper-only input - [`3799040`](https://github.com/Pasta-Devs/Marinara-Engine/commit/37990409a1c5e45aec60205182f07b9d75095953) Merge remote-tracking branch 'origin/staging' into fix/whisper-only-hidden-from-others ### 📊 Changes **6 files changed** (+143 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+4 -1) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+9 -2) 📝 `packages/server/src/services/generation/prompt-message-scope.ts` (+19 -0) 📝 `packages/server/src/services/generation/roleplay-commands.ts` (+45 -21) 📝 `scripts/regressions/roleplay-user-private-generation.regression.ts` (+65 -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 #7388 ## Why this change - In Roleplay, a message that is only a whisper (for example `[whisper: character="Maukie" text="..."]`) showed as `Mari: [Private whisper]` in every other character's prompt. That told the other characters the persona was there and talking, which spoils scenes such as sneaking up on someone. Mari reported this right after #7381, which made the same placeholder appear with Advanced Memory on too. - `conversationPromptHistoryContent` renders a whisper-only message as the `[Private whisper]` placeholder so `appendRoleplayWhispers` has a message to attach the whisper to. Nothing removed it for characters who get no whisper from it. ## What changed - `appendRoleplayWhispers` (roleplay-commands) first drops whisper-only messages (`roleplayWhisperOnlyMessageIds`) that deliver no whisper to this viewer, then inserts whisper text as before. The recipient and the appointed narrator keep the message. With no private viewer, as in merged group chats, nobody gets it. The live request and Peek Prompt both run this step. - `dropPromptHistoryMessages` (prompt-message-scope) removes history messages in place and moves the `<chat_history>` / `<last_message>` wrappers (and the Markdown equivalents) to what is left, using the existing `reassignHistoryLastMessageWrapper`. It removes only history entries left empty, so a reasoning-only assistant prefill stays. Dropping happens before any whisper text is inserted, so re-wrapping never meets whisper fragments. - A message is whisper-only only when it has no text, attachment or document. A reply that is a whisper plus a public `[document]` stays visible to everyone; only its whisper is private. - A private note the user shared with a character on a whisper-only message keeps that message in the character's prompt, so the note still arrives. - `{{input}}`, memory-recall queries and the Illustrator's prompt text get no text from a whisper-only turn (`latestRoleplayUserInput`), live and in Peek Prompt. Before, they got `[Private whisper]`. - Not changed: speaker selection and agents still see the message as `[Private whisper]` (never the text). They aren't characters, and Smart order can use the signal that someone whispered. Say if agents should drop it too. - Regression (`roleplay-user-private-generation`): a whisper-only message to Bob. Alice's Peek Prompt (also when impersonating) and live request contain neither the secret nor `[Private whisper`, with the last message and chat history each wrapped once, both while the whisper is the latest message and after a later reply. Bob and the narrator still receive it. Fails on staging with "no trace for others". Further cases: a shared note, a public document, `{{input}}`, and an empty reasoning prefill. Each fails without its own fix. ## Review - Local CodeRabbit (3 runs): one finding, the cost of rescanning history for `{{input}}`. Fixed. - Adversarial review (2 lenses, 2 skeptics per finding): the document, shared-note and prefill problems above were confirmed and fixed. Refuted: `{{input}}` (no worse than staging, fixed anyway because it is the same exposure) and continuing a character's whisper-only reply (intended). ## 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` Commands run by the agent: `pnpm check`; `node ./scripts/run-regressions.mjs --filter` for roleplay-user-private-generation, roleplay-whisper-hidden-recipient, roleplay-whisper-generation, roleplay-user-private-storage, roleplay-user-private-memory, roleplay-commands, roleplay-interrupt-generation, advanced-memory-visibility, advanced-memory-generation, advanced-memory-context and prompt (all pass). ### Manual verification notes - Manually verify in a Roleplay group chat: send only `[whisper: character="<name>" text="..."]`, then open Peek Prompt for another character and check the message is not there at all. - Manually verify the recipient's and the narrator's Peek Prompt still show it with the whisper. ## 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) CHANGELOG `[Unreleased]` has an entry. No user docs change. --- <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:46 +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#7712
No description provided.