[PR #7412] [MERGED] fix(roleplay): let a whisper typed into a reply go to the persona #7719

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

📋 Pull Request Information

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

Base: staging ← Head: fix/typed-whisper-persona


📝 Commits (5)

  • eb8268a fix(roleplay): let a whisper typed into a reply go to the persona
  • 8ba4beb Merge branch 'staging' into fix/typed-whisper-persona
  • 91ebc98 fix(roleplay): open a failed private command's notice by default
  • e9dde58 docs(changelog): tighten the typed whisper entry
  • 7a6754b Merge branch 'staging' into fix/typed-whisper-persona

📊 Changes

5 files changed (+67 additions, -8 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/client/src/components/chat/RoleplayCommandResults.tsx (+2 -1)
📝 packages/server/src/services/generation/roleplay-commands.ts (+12 -3)
📝 packages/server/src/services/storage/chats.storage.ts (+15 -3)
📝 scripts/regressions/roleplay-user-private-generation.regression.ts (+37 -1)

📄 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 #7411

Why this change

  • Mari reported that when the model writes a Roleplay whisper in the wrong format and she fixes the tag by editing the reply, the command registers but the whisper text disappears. Only a collapsed "Powers That Be used whisper command!" notice is left.
  • Her chat shows why. The edited narrator reply (2026-10-11 07:52Z) holds [whisper: character="Mari" text="…"], with Mari as the chat's persona. The text parsed fine (467 characters), but the whisper was saved with roleplay.commands.errors.whisperRecipient. A whisper with an error never renders inline, so its text vanished.
  • Cause: a typed whisper goes through prepareUserRoleplayCommands, which resolves the recipient against the chat's characters only. A reply's own whispers go through resolveRoleplayWhisperRecipient, which also includes the persona. So a whisper to the persona typed into a character's or the narrator's reply always failed.

What changed

  • prepareUserRoleplayCommands takes an optional persona. With it, the recipient is resolved by resolveRoleplayWhisperRecipient, the same resolver generation uses. Without it, behaviour is unchanged.

  • updateMessageContent passes the chat's persona only when a person edits a message that isn't theirs (authored and role not user). The persona comes from resolveChatUserIdentity, with generation's { id: "user", name: "User" } fallback when the chat has none, so a typed whisper gets the same recipient as one the reply wrote.

  • Typed whispers in your own messages still go to characters only, and generated rewrites still never read tags.

  • Regression (roleplay-user-private-generation), failing on staging:

    • fixing a malformed narrator whisper by PATCH, as [whisper: character=”Mari” text=”…”] with typographic quotes, saves a whisper to the persona, kept out of both other characters' prompts;
    • a user message whispering to the persona still gets the recipient error.
  • RoleplayCommandResults: a failed whisper or notes notice now starts open. Before, it read only " used whisper command!", which looked like success, and the reason and original text sat behind a click. Room guests don't render these notices.

Review (four lenses, two skeptics per finding, plus local CodeRabbit with no findings): no defect at head. Notes:

  • A message already broken by this bug isn't repaired automatically. Retype the whisper, whose text is under "Original command" in the notice, or regenerate the message. The old notice stays, as on staging. Auto-repair was rejected because combined with a retyped whisper it would duplicate it.
  • If the persona and a chat character share a name, a typed whisper to that name is now ambiguous and gets the recipient error. That matches what generation does with the same tag.
  • A typed whisper in a non-narrator character's reply can reach the persona even when "Who can whisper" is narrator-only, because the person typing chose it.

Not covered: in a multiplayer room, generation resolves room participants' personas. An edit outside a generation only knows the chat's persona.

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, and node ./scripts/run-regressions.mjs --filter for the 17 roleplay-*, prompt, message-edit-delete-races and chat-message-css-security regressions (all pass).

Manual verification notes

  • Manually verify in a Roleplay chat with a persona: edit a character's reply, type [whisper: character="<persona name>" text="secret"] and save. The whisper shows inline as "Whisper to ", with its text visible to you.
  • Manually verify that the same whisper typed into your own message still shows the recipient error.
  • Manually verify that a typed whisper to a name that isn't in the chat shows its notice already open, with the reason and the original tag.

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.

Summary by CodeRabbit

  • New Features
    • Whispers in character or narrator replies can be addressed to your persona.
    • Failed whisper and note commands display an open notice with the reason and original text.

🔄 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/7412 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/typed-whisper-persona` --- ### 📝 Commits (5) - [`eb8268a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eb8268a2ab879440e72f3104941b3b22320776f1) fix(roleplay): let a whisper typed into a reply go to the persona - [`8ba4beb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8ba4bebc49fa892b866651bdae733304fca133c7) Merge branch 'staging' into fix/typed-whisper-persona - [`91ebc98`](https://github.com/Pasta-Devs/Marinara-Engine/commit/91ebc9850141ec3a4789b130d9ddae292448eed3) fix(roleplay): open a failed private command's notice by default - [`e9dde58`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9dde58b927111a77de3b688670eb7ee50fabb67) docs(changelog): tighten the typed whisper entry - [`7a6754b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7a6754b3691884f74b3ae1a8313d3e9f3d638aee) Merge branch 'staging' into fix/typed-whisper-persona ### 📊 Changes **5 files changed** (+67 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/client/src/components/chat/RoleplayCommandResults.tsx` (+2 -1) 📝 `packages/server/src/services/generation/roleplay-commands.ts` (+12 -3) 📝 `packages/server/src/services/storage/chats.storage.ts` (+15 -3) 📝 `scripts/regressions/roleplay-user-private-generation.regression.ts` (+37 -1) </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 #7411 ## Why this change - Mari reported that when the model writes a Roleplay whisper in the wrong format and she fixes the tag by editing the reply, the command registers but the whisper text disappears. Only a collapsed "Powers That Be used whisper command!" notice is left. - Her chat shows why. The edited narrator reply (2026-10-11 07:52Z) holds `[whisper: character="Mari" text="…"]`, with Mari as the chat's persona. The text parsed fine (467 characters), but the whisper was saved with `roleplay.commands.errors.whisperRecipient`. A whisper with an error never renders inline, so its text vanished. - Cause: a typed whisper goes through `prepareUserRoleplayCommands`, which resolves the recipient against the chat's characters only. A reply's own whispers go through `resolveRoleplayWhisperRecipient`, which also includes the persona. So a whisper to the persona typed into a character's or the narrator's reply always failed. ## What changed - `prepareUserRoleplayCommands` takes an optional `persona`. With it, the recipient is resolved by `resolveRoleplayWhisperRecipient`, the same resolver generation uses. Without it, behaviour is unchanged. - `updateMessageContent` passes the chat's persona only when a person edits a message that isn't theirs (`authored` and role not `user`). The persona comes from `resolveChatUserIdentity`, with generation's `{ id: "user", name: "User" }` fallback when the chat has none, so a typed whisper gets the same recipient as one the reply wrote. - Typed whispers in your own messages still go to characters only, and generated rewrites still never read tags. - Regression (`roleplay-user-private-generation`), failing on staging: - fixing a malformed narrator whisper by PATCH, as `[whisper: character=”Mari” text=”…”]` with typographic quotes, saves a whisper to the persona, kept out of both other characters' prompts; - a user message whispering to the persona still gets the recipient error. - `RoleplayCommandResults`: a failed whisper or notes notice now starts open. Before, it read only "<name> used whisper command!", which looked like success, and the reason and original text sat behind a click. Room guests don't render these notices. Review (four lenses, two skeptics per finding, plus local CodeRabbit with no findings): no defect at head. Notes: - A message already broken by this bug isn't repaired automatically. Retype the whisper, whose text is under "Original command" in the notice, or regenerate the message. The old notice stays, as on staging. Auto-repair was rejected because combined with a retyped whisper it would duplicate it. - If the persona and a chat character share a name, a typed whisper to that name is now ambiguous and gets the recipient error. That matches what generation does with the same tag. - A typed whisper in a non-narrator character's reply can reach the persona even when "Who can whisper" is narrator-only, because the person typing chose it. Not covered: in a multiplayer room, generation resolves room participants' personas. An edit outside a generation only knows the chat's persona. ## 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`, and `node ./scripts/run-regressions.mjs --filter` for the 17 `roleplay-*`, `prompt`, `message-edit-delete-races` and `chat-message-css-security` regressions (all pass). ### Manual verification notes - Manually verify in a Roleplay chat with a persona: edit a character's reply, type `[whisper: character="<persona name>" text="secret"]` and save. The whisper shows inline as "Whisper to <persona>", with its text visible to you. - Manually verify that the same whisper typed into your own message still shows the recipient error. - Manually verify that a typed whisper to a name that isn't in the chat shows its notice already open, with the reason and the original tag. ## 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 is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Whispers in character or narrator replies can be addressed to your persona. * Failed whisper and note commands display an open notice with the reason and original text. <!-- 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:50 +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#7719
No description provided.