[GH-ISSUE #4694] [Issue]: Parallel Roleplay agents make typewriter streaming visibly chunky #2572

Closed
opened 2026-10-21 05:50:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Aug 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4694

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When one or more parallel agents, such as Echo Chamber, run alongside the main generation in Roleplay mode, the visible typewriter stream becomes noticeably chunky. The reply pauses briefly and then reveals several characters at once instead of maintaining a steady cadence.

Expected behavior

Roleplay text should retain a smooth, frame-paced typewriter effect while parallel agents run and complete. Agent result updates and auxiliary panel animations should not interrupt the visible main reply.

Actual behavior

With parallel agents enabled, the main Roleplay reply is visibly less smooth than the same generation without those agents. Delayed animation frames are followed by bursts of multiple characters, producing a stop-and-catch-up effect.

Steps to reproduce

  1. Open a Roleplay chat with streaming and the typewriter effect enabled.
  2. Enable a parallel agent such as Echo Chamber.
  3. Send a prompt that produces a sufficiently long response.
  4. Observe the main reply while the parallel agent finishes and its result is applied.
  5. Repeat with the parallel agent disabled and compare the visible streaming cadence.

Environment

  • Marinara Engine version: Not recorded for this reproduction
  • Install type: Not recorded for this reproduction
  • OS + version: Not recorded for this reproduction
  • Browser or app shell: Not recorded for this reproduction

Logs, screenshots, or video

No dedicated performance capture has been recorded for this exact parallel-agent reproduction.

The earlier Firefox profile discussed in #4659 predates the stable live-text-node fix and therefore is not direct proof of this issue. It does, however, show that Roleplay-wide UI updates and scroll/layout work can consume multiple animation frames.

Additional context

Code-path inspection indicates a specific contention window:

  • The server starts parallel agents alongside the main generation but defers their agent_start and agent_result events until the main model transport has completed.
  • The client may still be visibly draining a substantial Roleplay typewriter backlog when those deferred events arrive.
  • Applying an agent result can synchronously update the result store, thought bubbles, Echo Chamber messages, related panels, query caches, and other agent-specific UI.
  • The typewriter frame budget accrues characters from elapsed wall-clock time, with delayed frames counted up to 120 ms. After UI work delays a frame, the next frame therefore reveals several graphemes at once to catch up.
  • Echo Chamber can add further timed rendering and auto-scroll work while the main reply is still visible.

A narrow fix should be investigated before broader rendering changes:

  1. Hold noncritical Roleplay agent UI events while the visible typewriter has pending text, then apply them together after the typewriter drains.
  2. Bound Roleplay catch-up to a normal per-frame reveal amount and carry remaining character debt forward rather than releasing it in one burst.
  3. Avoid starting smooth Echo Chamber auto-scroll animations while the main Roleplay reply is streaming.

This is distinct from #4659, which addressed replacing the live stream's DOM text node on every frame.

Template check

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

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4694 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When one or more parallel agents, such as Echo Chamber, run alongside the main generation in Roleplay mode, the visible typewriter stream becomes noticeably chunky. The reply pauses briefly and then reveals several characters at once instead of maintaining a steady cadence. ## Expected behavior Roleplay text should retain a smooth, frame-paced typewriter effect while parallel agents run and complete. Agent result updates and auxiliary panel animations should not interrupt the visible main reply. ## Actual behavior With parallel agents enabled, the main Roleplay reply is visibly less smooth than the same generation without those agents. Delayed animation frames are followed by bursts of multiple characters, producing a stop-and-catch-up effect. ## Steps to reproduce 1. Open a Roleplay chat with streaming and the typewriter effect enabled. 2. Enable a parallel agent such as Echo Chamber. 3. Send a prompt that produces a sufficiently long response. 4. Observe the main reply while the parallel agent finishes and its result is applied. 5. Repeat with the parallel agent disabled and compare the visible streaming cadence. ## Environment - Marinara Engine version: Not recorded for this reproduction - Install type: Not recorded for this reproduction - OS + version: Not recorded for this reproduction - Browser or app shell: Not recorded for this reproduction ## Logs, screenshots, or video No dedicated performance capture has been recorded for this exact parallel-agent reproduction. The earlier Firefox profile discussed in #4659 predates the stable live-text-node fix and therefore is not direct proof of this issue. It does, however, show that Roleplay-wide UI updates and scroll/layout work can consume multiple animation frames. ## Additional context Code-path inspection indicates a specific contention window: - The server starts parallel agents alongside the main generation but defers their `agent_start` and `agent_result` events until the main model transport has completed. - The client may still be visibly draining a substantial Roleplay typewriter backlog when those deferred events arrive. - Applying an agent result can synchronously update the result store, thought bubbles, Echo Chamber messages, related panels, query caches, and other agent-specific UI. - The typewriter frame budget accrues characters from elapsed wall-clock time, with delayed frames counted up to 120 ms. After UI work delays a frame, the next frame therefore reveals several graphemes at once to catch up. - Echo Chamber can add further timed rendering and auto-scroll work while the main reply is still visible. A narrow fix should be investigated before broader rendering changes: 1. Hold noncritical Roleplay agent UI events while the visible typewriter has pending text, then apply them together after the typewriter drains. 2. Bound Roleplay catch-up to a normal per-frame reveal amount and carry remaining character debt forward rather than releasing it in one burst. 3. Avoid starting smooth Echo Chamber auto-scroll animations while the main Roleplay reply is streaming. This is distinct from #4659, which addressed replacing the live stream's DOM text node on every frame. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [x] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:50:26 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 6, 2026):

Claimed by @SpicyMarinara. Implementation and validation are being tracked in draft PR #4697.

<!-- gh-comment-id:5209517061 --> @SpicyMarinara commented on GitHub (Aug 6, 2026): Claimed by @SpicyMarinara. Implementation and validation are being tracked in draft PR #4697.
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#2572
No description provided.