[PR #8383] [MERGED] fix: preserve linked roleplay OOC-only replies #8568

Closed
opened 2026-11-07 16:45:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix/8382-linked-ooc-replies


📝 Commits (3)

  • 21b2c96 test: reproduce linked roleplay OOC-only reply loss (#8382)
  • 889a2f9 fix: retain OOC-only roleplay answers after cleanup
  • b0271b6 fix: enforce speaker cleanup on recovered OOC text

📊 Changes

3 files changed (+267 additions, -1 deletions)

View changed files

📝 packages/server/src/routes/generate/reply-text-cleanup.ts (+17 -1)
📝 scripts/regressions/generate-reply-text-cleanup.regression.ts (+54 -0)
➕ scripts/regressions/linked-ooc-replies.regression.ts (+196 -0)

📄 Description

Linked issue

Closes #8382

Why this change

A valid Roleplay answer consisting entirely of OOC blocks was stripped to empty and discarded before its text could reach the connected conversation. This lost generated content and incorrectly told the user that the model returned nothing.

What changed

  • Keep an OOC-only answer visible in the Roleplay chat, with the OOC tags removed, instead of discarding the turn. Multiple blocks keep their order and are not duplicated into the connected conversation.
  • Apply the safeguard after speaker-prefix and ending cleanup, so individual-group replies such as Dottore: <OOC>answer</OOC> also survive.
  • Keep mixed narrative/OOC forwarding unchanged. Unlinked chats, impersonation, malformed tags, and wrong-speaker filtering retain their existing behavior.
  • Log the preservation fallback at the default warning level, with the chat IDs and block count but no generated text.

Validation

  • pnpm install completed.
  • pnpm check passed, including formatting, localization, type checks, lint, and production build; one existing client hook warning remains.
  • Cleanup regression: reproduced the failure before the fix; the expanded table passes after it.
  • Real generation-route/storage regression: before the fix, four target cases failed and four controls passed; after the fix, all eight pass. Coverage includes normal generation, regeneration retaining its original swipe, continuation retaining message identity, ordered multiple OOC blocks, exact mixed-response forwarding, and visibility/SSE completion.
  • pnpm regression:prompt passed all three regression files.
  • pnpm smoke:ui passed all seven desktop Chromium cases on the final head.
  • Local CodeRabbit review completed on the final head with zero remaining findings. Its initial wrong-speaker finding was reproduced, repaired using the existing cleanup function, and covered by a failing-then-passing regression. Independent source review also passed.

Manual verification notes

  • Manually verify an OOC-only response in a linked Roleplay chat using a real provider.
  • Manually verify mixed narrative/OOC forwarding in the connected conversation.

The generation regression uses the real route and disposable file-backed storage with a synthetic streaming provider. It does not claim real-provider verification. No client layout or controls changed.

Docs and release impact

No install, update, storage schema, provider, version, or documentation changes.

Validated feature head: b0271b607a8ef3be823ff79de9d03635e5c288f6. GitHub CI and Dottore Review remain merge gates.


🔄 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/8383 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/8382-linked-ooc-replies` --- ### 📝 Commits (3) - [`21b2c96`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21b2c966d0fce44df0bc2eb19929edf2a367dc01) test: reproduce linked roleplay OOC-only reply loss (#8382) - [`889a2f9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/889a2f997ae77d14de6a4e7c39373b9743a7effe) fix: retain OOC-only roleplay answers after cleanup - [`b0271b6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0271b607a8ef3be823ff79de9d03635e5c288f6) fix: enforce speaker cleanup on recovered OOC text ### 📊 Changes **3 files changed** (+267 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate/reply-text-cleanup.ts` (+17 -1) 📝 `scripts/regressions/generate-reply-text-cleanup.regression.ts` (+54 -0) ➕ `scripts/regressions/linked-ooc-replies.regression.ts` (+196 -0) </details> ### 📄 Description ## Linked issue Closes #8382 ## Why this change A valid Roleplay answer consisting entirely of OOC blocks was stripped to empty and discarded before its text could reach the connected conversation. This lost generated content and incorrectly told the user that the model returned nothing. ## What changed - Keep an OOC-only answer visible in the Roleplay chat, with the OOC tags removed, instead of discarding the turn. Multiple blocks keep their order and are not duplicated into the connected conversation. - Apply the safeguard after speaker-prefix and ending cleanup, so individual-group replies such as `Dottore: <OOC>answer</OOC>` also survive. - Keep mixed narrative/OOC forwarding unchanged. Unlinked chats, impersonation, malformed tags, and wrong-speaker filtering retain their existing behavior. - Log the preservation fallback at the default warning level, with the chat IDs and block count but no generated text. ## Validation - `pnpm install` completed. - `pnpm check` passed, including formatting, localization, type checks, lint, and production build; one existing client hook warning remains. - Cleanup regression: reproduced the failure before the fix; the expanded table passes after it. - Real generation-route/storage regression: before the fix, four target cases failed and four controls passed; after the fix, all eight pass. Coverage includes normal generation, regeneration retaining its original swipe, continuation retaining message identity, ordered multiple OOC blocks, exact mixed-response forwarding, and visibility/SSE completion. - `pnpm regression:prompt` passed all three regression files. - `pnpm smoke:ui` passed all seven desktop Chromium cases on the final head. - Local CodeRabbit review completed on the final head with zero remaining findings. Its initial wrong-speaker finding was reproduced, repaired using the existing cleanup function, and covered by a failing-then-passing regression. Independent source review also passed. ### Manual verification notes - [ ] Manually verify an OOC-only response in a linked Roleplay chat using a real provider. - [ ] Manually verify mixed narrative/OOC forwarding in the connected conversation. The generation regression uses the real route and disposable file-backed storage with a synthetic streaming provider. It does not claim real-provider verification. No client layout or controls changed. ## Docs and release impact No install, update, storage schema, provider, version, or documentation changes. Validated feature head: `b0271b607a8ef3be823ff79de9d03635e5c288f6`. GitHub CI and Dottore Review remain merge gates. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:45:39 +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#8568
No description provided.