[GH-ISSUE #5994] [Issue]: Roleplay live streaming bypasses AI-output display regex scripts #3317

Closed
opened 2026-10-21 06:01:56 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ghost on GitHub (Sep 9, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5994

Originally assigned to: @SpicyMarinara on GitHub.

Summary

In Roleplay mode, live streamed assistant text bypasses display regex scripts. Freaky Frankenstein dialogue tags such as <gold:measured>"Dialogue."</gold:measured> remain uncolored during generation and are transformed only after the response is committed.

Expected behavior

Roleplay streaming should display the same enabled AI-output/display-regex transformations as the finalized assistant message.

When a streamed fragment contains a complete regex match, the replacement should appear during streaming without waiting for generation to finish.

Incomplete syntax at the stream boundary should remain unchanged until enough text exists for a valid match.

Actual behavior

The Roleplay live-stream output remains raw while the response is being generated. Display regex transformations do not appear during streaming.

After generation completes, the persisted message is rendered through the normal display pipeline and the Freaky Frankenstein regex transforms the content into a styled span. The dialogue color therefore appears suddenly only after the response is committed.

For example, a complete streamed fragment such as:

gold:measured"Hello."</gold:measured>

remains visible as raw text during the live response, then becomes colored after completion.

Steps to reproduce

  1. Enable an AI-output/display regex such as:

<\s{0,8}(cyan|pink|teal|orange|gold|violet|salmon|orchid|yellow|plum)\s{0,8}>([“"][^”"]{1,2000}?[”"])(?:\s{0,8}<\s{0,8}/\s{0,8}[^<>\n\r]{0,40}>|\s{0,8}<\s{0,8}/\s{0,8}[a-zA-Z0-9_-]{0,24}:|\s{0,8}\1>)?

  1. Use the replacement:

$2

  1. Open a Roleplay chat with streaming enabled.

  2. Generate a response containing a complete fragment such as:

"Hello."

  1. Observe the streamed response before generation completes.

  2. Observe that the raw color tag remains visible and uncolored during the live stream.

  3. Wait for generation to finish.

  4. Observe that the same text becomes colored only after the message is committed.

Environment

  • Marinara Engine version: 2.4.4
  • Install type: Docker
  • OS + version: Debian GNU/Linux 12 (bookworm) host
  • Browser or app shell: Web UI; exact browser not provided

Logs, screenshots, or video

No runtime exception is emitted.

This appears to be a deterministic rendering discrepancy between the live streaming path and the finalized-message path.

The relevant behavior is:

Committed assistant messages are transformed through the AI-output display-regex pipeline.

Live Roleplay stream content is rendered without the same display-regex transformation.

The current Freaky Frankenstein regexes intentionally require a closing quotation mark:

  • <gold:measured>"Hello does not match yet.
  • <gold:measured>"Hello." matches and should be transformed.

The second form still remains uncolored during live streaming.

Additional context

Related upstream history:

  • #4714 reported that Roleplay streaming showed formatting only after generation completed.
  • #4717 changed the stream to reuse the normal content renderer, restoring Markdown and built-in dialogue formatting, but display-regex formatting still does not appear during live output.
  • #3164 and #3166 discuss display-regex and macro rendering behavior during streaming.
  • The issue is especially visible with Freaky Frankenstein dialogue colorizer scripts, but may affect any enabled AI-output/display-regex script.

Template check

Please uncheck the box below before submitting so we know you read this template. It is intentionally pre-checked:

Helper summary: The live Roleplay rendering path and the finalized-message rendering path produce different visible output for the same assistant response.

Originally created by @ghost on GitHub (Sep 9, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5994 Originally assigned to: @SpicyMarinara on GitHub. ## Summary In Roleplay mode, live streamed assistant text bypasses display regex scripts. Freaky Frankenstein dialogue tags such as `<gold:measured>"Dialogue."</gold:measured>` remain uncolored during generation and are transformed only after the response is committed. ## Expected behavior Roleplay streaming should display the same enabled AI-output/display-regex transformations as the finalized assistant message. When a streamed fragment contains a complete regex match, the replacement should appear during streaming without waiting for generation to finish. Incomplete syntax at the stream boundary should remain unchanged until enough text exists for a valid match. ## Actual behavior The Roleplay live-stream output remains raw while the response is being generated. Display regex transformations do not appear during streaming. After generation completes, the persisted message is rendered through the normal display pipeline and the Freaky Frankenstein regex transforms the content into a styled span. The dialogue color therefore appears suddenly only after the response is committed. For example, a complete streamed fragment such as: <gold:measured>"Hello."</gold:measured> remains visible as raw text during the live response, then becomes colored after completion. ## Steps to reproduce 1. Enable an AI-output/display regex such as: <\s{0,8}(cyan|pink|teal|orange|gold|violet|salmon|orchid|yellow|plum)\s{0,8}>([“"][^”"]{1,2000}?[”"])(?:\s{0,8}<\s{0,8}\/\s{0,8}[^<>\n\r]{0,40}>|\s{0,8}<\s{0,8}\/\s{0,8}[a-zA-Z0-9_-]{0,24}:|\s{0,8}\1>)? 2. Use the replacement: <span style="color:$1;">$2</span> 3. Open a Roleplay chat with streaming enabled. 4. Generate a response containing a complete fragment such as: <gold>"Hello."</gold> 5. Observe the streamed response before generation completes. 6. Observe that the raw color tag remains visible and uncolored during the live stream. 7. Wait for generation to finish. 8. Observe that the same text becomes colored only after the message is committed. ## Environment - Marinara Engine version: 2.4.4 - Install type: Docker - OS + version: Debian GNU/Linux 12 (bookworm) host - Browser or app shell: Web UI; exact browser not provided ## Logs, screenshots, or video No runtime exception is emitted. This appears to be a deterministic rendering discrepancy between the live streaming path and the finalized-message path. The relevant behavior is: Committed assistant messages are transformed through the AI-output display-regex pipeline. Live Roleplay stream content is rendered without the same display-regex transformation. The current Freaky Frankenstein regexes intentionally require a closing quotation mark: - `<gold:measured>"Hello` does not match yet. - `<gold:measured>"Hello."` matches and should be transformed. The second form still remains uncolored during live streaming. ## Additional context Related upstream history: - #4714 reported that Roleplay streaming showed formatting only after generation completed. - #4717 changed the stream to reuse the normal content renderer, restoring Markdown and built-in dialogue formatting, but display-regex formatting still does not appear during live output. - #3164 and #3166 discuss display-regex and macro rendering behavior during streaming. - The issue is especially visible with Freaky Frankenstein dialogue colorizer scripts, but may affect any enabled AI-output/display-regex script. ## Template check Please uncheck the box below before submitting so we know you read this template. It is intentionally pre-checked: - [ ] Helper summary: The live Roleplay rendering path and the finalized-message rendering path produce different visible output for the same assistant response.
bsakaguchi 2026-10-21 06:01:56 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 9, 2026):

Owner: @SpicyMarinara, assisted by Codex. Taking this issue in the assigned-issue sweep, PR #6007 targeting staging. Existing outside contributor PRs are excluded from the sweep.

<!-- gh-comment-id:5606718150 --> @SpicyMarinara commented on GitHub (Sep 9, 2026): Owner: @SpicyMarinara, assisted by Codex. Taking this issue in the assigned-issue sweep, PR #6007 targeting staging. Existing outside contributor PRs are excluded from the sweep.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 9, 2026):

Addressed in #6007, merged into staging as 46d184753d. The final CI matrix and CodeRabbit review passed; validation details and manual follow-up checks are in the PR.

<!-- gh-comment-id:5608333115 --> @SpicyMarinara commented on GitHub (Sep 9, 2026): Addressed in #6007, merged into `staging` as 46d184753dc4fc65caf00e982847688b5df59095. The final CI matrix and CodeRabbit review passed; validation details and manual follow-up checks are in the PR.
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#3317
No description provided.