[PR #3482] [MERGED] Fix Roleplay rewrite streaming and Professor Mari lorebook saves #5960

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

📋 Pull Request Information

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

Base: staging ← Head: agent/fix-roleplay-rewrites-lorebook-saves


📝 Commits (3)

  • 73d0f8e Fix roleplay rewrites and lorebook saves
  • 9d37f37 Merge remote-tracking branch 'origin/staging' into agent/fix-roleplay-rewrites-lorebook-saves
  • 10ceb9c Address CodeRabbit streaming review

📊 Changes

29 files changed (+622 additions, -160 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 docs/agents/agents-overview.md (+1 -1)
📝 docs/agents/built-in-agents.md (+0 -8)
📝 docs/agents/custom-agents.md (+1 -1)
📝 docs/chats/messages.md (+1 -1)
📝 docs/conversation/profiles.md (+0 -14)
📝 e2e/core-flows.e2e.ts (+114 -0)
📝 package.json (+2 -1)
📝 packages/client/src/components/chat/ChatArea.tsx (+20 -4)
📝 packages/client/src/components/chat/ChatMessage.tsx (+46 -31)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+1 -0)
📝 packages/client/src/components/chat/ConversationView.tsx (+20 -1)
📝 packages/client/src/components/chat/HomeFaq.tsx (+1 -1)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+3 -0)
📝 packages/client/src/hooks/use-generate.ts (+44 -67)
📝 packages/client/src/hooks/use-lorebooks.ts (+6 -3)
➕ packages/client/src/lib/generation-stream-policy.ts (+23 -0)
➕ packages/client/src/lib/message-rewrite-versions.ts (+41 -0)
📝 packages/server/src/routes/generate.routes.ts (+1 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+3 -1)

...and 9 more files

📄 Description

Linked issue

No linked issue. This is a maintainer-requested batch from active Roleplay and Lorebook testing.

Why this change

  • Roleplay streams could collapse into a completed message when post-processing agents started, and held rewrites did not keep the viewport synchronized with the typewriter.
  • The rewrite shield destructively restored the original and erased the rewritten version, preventing comparison or switching back.
  • Rewrite agents were grouped with tracker calls even though they are a separate post-processing workload.
  • Professor Mari-created lorebooks could contain values outside the public editor schema, causing later manual saves to fail.
  • Lorebook Save invalidation could briefly rehydrate stale detail data and reshuffle the Overview.

What changed

  • Keep the live Roleplay stream authoritative through post-processing and stream held rewritten output before the durable handoff.
  • Coalesce bottom-follow scrolling to animation frames and preserve deliberate user scroll-away.
  • Store original and rewritten message versions and make the shield a persistent two-way toggle.
  • Isolate Prose Guardian, Continuity Checker, and Immersive HTML into a shared rewrite lane separate from tracker batches.
  • Hide the legacy About Me Keeper from manual agent selection.
  • Prime Lorebook detail data from the PATCH response and surface save success/failure.
  • Normalize existing and future Professor Mari-created Lorebook categories and advanced numeric values.
  • Update user documentation, FAQ copy, and the v2.2.0 changelog.
  • Add focused Roleplay, Lorebook, and browser regressions.

Validation

  • Run pnpm check
  • Run pnpm regression:roleplay
  • Run pnpm regression:issues
  • Manually verify rewritten streaming follows the bottom while the user remains near it
  • Manually verify scrolling upward disengages stream following
  • Manually verify the shield switches rewritten → original → rewritten and remains available
  • Manually verify a Professor Mari-created lorebook can disable Global and save without layout twitching

Automated validation completed locally before submission: pnpm check, pnpm regression:roleplay, pnpm regression:issues, focused Playwright tests for Lorebook save stability and repeated rewrite toggling, targeted ESLint, and git diff --check.

Risk and compatibility

  • Legacy rewritten messages that still retain the original metadata are upgraded on first toggle.
  • Messages restored before this fix erased their rewritten text and cannot be reconstructed automatically.
  • Existing malformed Professor Mari lorebooks are normalized at the storage boundary when read, then persist normalized values on the next save.

Summary by CodeRabbit

  • New Features
    • Prose Guardian now provides a persistent shield control to compare original vs rewritten message versions.
    • Conversation mode no longer shows built-in agents by default, while custom agents remain available.
  • Bug Fixes
    • Improved Roleplay streaming stability during post-processing (including background tab behavior) and ensured rewritten final responses render correctly.
    • Lorebook saving and editing are more reliable, including category normalization, numeric option bounds, and global save behavior.
    • Streaming auto-scroll stays synchronized without disrupting intentional scrolling.
  • Documentation
    • Updated agents, message, FAQ, and lorebook guidance to match the new Prose Guardian and Conversation behavior.

🔄 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/3482 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/11/2026 **Status:** ✅ Merged **Merged:** 7/11/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/fix-roleplay-rewrites-lorebook-saves` --- ### 📝 Commits (3) - [`73d0f8e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/73d0f8ec61bc6e9b5296a1fc91c937d67f4a52fd) Fix roleplay rewrites and lorebook saves - [`9d37f37`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9d37f376012993f849aab060b519eff5103efc76) Merge remote-tracking branch 'origin/staging' into agent/fix-roleplay-rewrites-lorebook-saves - [`10ceb9c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/10ceb9c483946222b501a1bf60b8c74798108a5d) Address CodeRabbit streaming review ### 📊 Changes **29 files changed** (+622 additions, -160 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `docs/agents/agents-overview.md` (+1 -1) 📝 `docs/agents/built-in-agents.md` (+0 -8) 📝 `docs/agents/custom-agents.md` (+1 -1) 📝 `docs/chats/messages.md` (+1 -1) 📝 `docs/conversation/profiles.md` (+0 -14) 📝 `e2e/core-flows.e2e.ts` (+114 -0) 📝 `package.json` (+2 -1) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+20 -4) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+46 -31) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+1 -0) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+20 -1) 📝 `packages/client/src/components/chat/HomeFaq.tsx` (+1 -1) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+3 -0) 📝 `packages/client/src/hooks/use-generate.ts` (+44 -67) 📝 `packages/client/src/hooks/use-lorebooks.ts` (+6 -3) ➕ `packages/client/src/lib/generation-stream-policy.ts` (+23 -0) ➕ `packages/client/src/lib/message-rewrite-versions.ts` (+41 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+1 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+3 -1) _...and 9 more files_ </details> ### 📄 Description ## Linked issue No linked issue. This is a maintainer-requested batch from active Roleplay and Lorebook testing. ## Why this change - Roleplay streams could collapse into a completed message when post-processing agents started, and held rewrites did not keep the viewport synchronized with the typewriter. - The rewrite shield destructively restored the original and erased the rewritten version, preventing comparison or switching back. - Rewrite agents were grouped with tracker calls even though they are a separate post-processing workload. - Professor Mari-created lorebooks could contain values outside the public editor schema, causing later manual saves to fail. - Lorebook Save invalidation could briefly rehydrate stale detail data and reshuffle the Overview. ## What changed - Keep the live Roleplay stream authoritative through post-processing and stream held rewritten output before the durable handoff. - Coalesce bottom-follow scrolling to animation frames and preserve deliberate user scroll-away. - Store original and rewritten message versions and make the shield a persistent two-way toggle. - Isolate Prose Guardian, Continuity Checker, and Immersive HTML into a shared rewrite lane separate from tracker batches. - Hide the legacy About Me Keeper from manual agent selection. - Prime Lorebook detail data from the PATCH response and surface save success/failure. - Normalize existing and future Professor Mari-created Lorebook categories and advanced numeric values. - Update user documentation, FAQ copy, and the v2.2.0 changelog. - Add focused Roleplay, Lorebook, and browser regressions. ## Validation - [ ] Run `pnpm check` - [ ] Run `pnpm regression:roleplay` - [ ] Run `pnpm regression:issues` - [ ] Manually verify rewritten streaming follows the bottom while the user remains near it - [ ] Manually verify scrolling upward disengages stream following - [ ] Manually verify the shield switches rewritten → original → rewritten and remains available - [ ] Manually verify a Professor Mari-created lorebook can disable Global and save without layout twitching Automated validation completed locally before submission: `pnpm check`, `pnpm regression:roleplay`, `pnpm regression:issues`, focused Playwright tests for Lorebook save stability and repeated rewrite toggling, targeted ESLint, and `git diff --check`. ## Risk and compatibility - Legacy rewritten messages that still retain the original metadata are upgraded on first toggle. - Messages restored before this fix erased their rewritten text and cannot be reconstructed automatically. - Existing malformed Professor Mari lorebooks are normalized at the storage boundary when read, then persist normalized values on the next save. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Prose Guardian now provides a persistent shield control to compare original vs rewritten message versions. * Conversation mode no longer shows built-in agents by default, while custom agents remain available. * **Bug Fixes** * Improved Roleplay streaming stability during post-processing (including background tab behavior) and ensured rewritten final responses render correctly. * Lorebook saving and editing are more reliable, including category normalization, numeric option bounds, and global save behavior. * Streaming auto-scroll stays synchronized without disrupting intentional scrolling. * **Documentation** * Updated agents, message, FAQ, and lorebook guidance to match the new Prose Guardian and Conversation behavior. <!-- 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-23 04:05: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#5960
No description provided.