[PR #8655] [MERGED] fix(vn): VN mode stays on the paragraph you are reading, and swipes keep their own text #8727

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

📋 Pull Request Information

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

Base: staging ← Head: fix/vn-mode-streaming-swipes-8635-8636


📝 Commits (1)

  • 83d083d fix(vn): Roleplay VN stays on the paragraph you are reading, and swipes keep their own text (#8635, #8636)

📊 Changes

4 files changed (+343 additions, -76 deletions)

View changed files

📝 e2e/roleplay-vn.e2e.ts (+244 -9)
📝 packages/client/src/components/chat/ChatMessage.tsx (+5 -2)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+93 -65)
📝 packages/client/src/localization/locales/en.json (+1 -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 #8635
Closes #8636

Why this change

  • #8635. In Roleplay VN mode with streaming on, the text box followed the newest finished paragraph while a reply streamed in, then jumped back to the first paragraph when the reply saved. You couldn't read at your own pace, and the box changed under you.
  • #8636. After a regenerate, switching back to swipe 1/2 sometimes showed swipe 2's text on both swipes. This happens while a text-rewrite agent (Prose Guardian, Continuity, Immersive HTML or a custom rewrite) holds the regenerated reply. The swipe arrows still worked in that window, and switching changed the active swipe on the server. The rewrite then saved into whichever swipe was active, so swipe 1 really did end up holding swipe 2's text.

What changed

  • ChatRoleplaySurface.tsx (#8635):
    • A streaming reply opens at paragraph 1 and moves only when you click Next.
    • The navigation bar now shows during the stream, with a "1 / 3+" counter (new key chat.roleplayVn.paragraphCounterStreaming, English only).
    • When the stream ends, you stay where you were. A reply that finished while you were in another chat still opens at its first paragraph.
    • In a group chat, each character's turn opens at its own first paragraph.
    • A Continue opens on the paragraph its new text extends.
    • A stream that ends without saving (stopped or failed) brings the old swipe back at the paragraph you'd reached.
    • The paragraph position is capped at the reply's length, so the counter never reads "4 / 3".
  • ChatMessage.tsx (#8636): a message's Previous/Next swipe controls are hidden while that message's reply is still being written. Keyboard and touch swipes were already blocked then. This guard is client-only.
  • e2e/roleplay-vn.e2e.ts: each new test fails on the old code:
    • stays on the paragraph being read while a reply streams in;
    • keeps each swipe's own text when a held rewrite finishes (checked in the database);
    • starts each group turn at its first paragraph and keeps the counter in range;
    • opens a continuation on the paragraph its new text extends.
    • The existing "waits for complete streaming paragraphs" test now expects the new behaviour.

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

Manual verification notes

What the agent ran locally:

  • After rebasing on staging, node ./scripts/pnpm-runner.mjs check, localization:check and check:e2e-types pass.
  • e2e/roleplay-vn.e2e.ts passes all 20 tests on desktop Chromium. So do tracker-manual-edit-base and chat-widget-dialogue-colors, which click swipe controls.
  • Three tests in e2e/roleplay-commands.e2e.ts fail: "sound commands reuse cached audio", and the native and textual roll continuations. They fail the same way with this PR's client changes reverted to staging (a sound playback request that never comes, and a dice-roll colour), so they aren't caused by this PR.
  • An independent review agent fixed group turns, the counter cap and continuation landing, each with a new test. Local CodeRabbit reported 0 findings.

For a human to verify:

  • In Firefox with streaming on, send a Roleplay VN message that gets a multi-paragraph reply. Manually verify that the box stays on paragraph 1, the counter reads like "1 / 4+", Next moves forward during the stream, and nothing jumps when the stream finishes.
  • In Firefox with Prose Guardian (or another rewrite agent) on, regenerate the latest reply. Manually verify that the swipe arrows are hidden until the rewrite finishes, then switch between 1/2 and 2/2 and confirm each shows its own text, in history and in the VN box.
  • Manually verify that a Continue in VN mode opens on the paragraph being extended, and that in a group chat each character's turn starts at its first paragraph.
  • Manually verify that stopping a generation mid-stream in VN mode leaves the view on a sensible paragraph of the restored swipe.

Follow-up, not in this PR: the server still accepts an active-swipe change while a held rewrite is pending, so another tab or device could still land a rewrite on the wrong swipe. Making the rewrite save target the generated swipe would close that gap on the server too.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

No docs change: these are bug fixes to existing VN behaviour.

🤖 Generated with Claude Code


🔄 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/8655 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/vn-mode-streaming-swipes-8635-8636` --- ### 📝 Commits (1) - [`83d083d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/83d083dbfa8724a0796e8e4a37d0742c7a93898f) fix(vn): Roleplay VN stays on the paragraph you are reading, and swipes keep their own text (#8635, #8636) ### 📊 Changes **4 files changed** (+343 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `e2e/roleplay-vn.e2e.ts` (+244 -9) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+5 -2) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+93 -65) 📝 `packages/client/src/localization/locales/en.json` (+1 -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`. ## Linked issue Closes #8635 Closes #8636 ## Why this change - **#8635.** In Roleplay VN mode with streaming on, the text box followed the newest finished paragraph while a reply streamed in, then jumped back to the first paragraph when the reply saved. You couldn't read at your own pace, and the box changed under you. - **#8636.** After a regenerate, switching back to swipe 1/2 sometimes showed swipe 2's text on both swipes. This happens while a text-rewrite agent (Prose Guardian, Continuity, Immersive HTML or a custom rewrite) holds the regenerated reply. The swipe arrows still worked in that window, and switching changed the active swipe on the server. The rewrite then saved into whichever swipe was active, so swipe 1 really did end up holding swipe 2's text. ## What changed - **`ChatRoleplaySurface.tsx` (#8635):** - A streaming reply opens at paragraph 1 and moves only when you click Next. - The navigation bar now shows during the stream, with a "1 / 3+" counter (new key `chat.roleplayVn.paragraphCounterStreaming`, English only). - When the stream ends, you stay where you were. A reply that finished while you were in another chat still opens at its first paragraph. - In a group chat, each character's turn opens at its own first paragraph. - A Continue opens on the paragraph its new text extends. - A stream that ends without saving (stopped or failed) brings the old swipe back at the paragraph you'd reached. - The paragraph position is capped at the reply's length, so the counter never reads "4 / 3". - **`ChatMessage.tsx` (#8636):** a message's Previous/Next swipe controls are hidden while that message's reply is still being written. Keyboard and touch swipes were already blocked then. This guard is client-only. - **`e2e/roleplay-vn.e2e.ts`:** each new test fails on the old code: - stays on the paragraph being read while a reply streams in; - keeps each swipe's own text when a held rewrite finishes (checked in the database); - starts each group turn at its first paragraph and keeps the counter in range; - opens a continuation on the paragraph its new text extends. - The existing "waits for complete streaming paragraphs" test now expects the new behaviour. ## 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` ### Manual verification notes What the agent ran locally: - After rebasing on staging, `node ./scripts/pnpm-runner.mjs check`, `localization:check` and `check:e2e-types` pass. - `e2e/roleplay-vn.e2e.ts` passes all 20 tests on desktop Chromium. So do `tracker-manual-edit-base` and `chat-widget-dialogue-colors`, which click swipe controls. - Three tests in `e2e/roleplay-commands.e2e.ts` fail: "sound commands reuse cached audio", and the native and textual roll continuations. They fail the same way with this PR's client changes reverted to staging (a sound playback request that never comes, and a dice-roll colour), so they aren't caused by this PR. - An independent review agent fixed group turns, the counter cap and continuation landing, each with a new test. Local CodeRabbit reported 0 findings. For a human to verify: - In Firefox with streaming on, send a Roleplay VN message that gets a multi-paragraph reply. Manually verify that the box stays on paragraph 1, the counter reads like "1 / 4+", Next moves forward during the stream, and nothing jumps when the stream finishes. - In Firefox with Prose Guardian (or another rewrite agent) on, regenerate the latest reply. Manually verify that the swipe arrows are hidden until the rewrite finishes, then switch between 1/2 and 2/2 and confirm each shows its own text, in history and in the VN box. - Manually verify that a Continue in VN mode opens on the paragraph being extended, and that in a group chat each character's turn starts at its first paragraph. - Manually verify that stopping a generation mid-stream in VN mode leaves the view on a sensible paragraph of the restored swipe. **Follow-up, not in this PR:** the server still accepts an active-swipe change while a held rewrite is pending, so another tab or device could still land a rewrite on the wrong swipe. Making the rewrite save target the generated swipe would close that gap on the server too. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) No docs change: these are bug fixes to existing VN behaviour. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:17 +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#8727
No description provided.