[GH-ISSUE #3121] [Issue]: Conversation mode doesn't stagger messages when there are multiple characters (all appear at once) #1673

Closed
opened 2026-10-21 05:41:34 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3121

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

In Conversation mode, a single-character reply that splits into several "messages" reveals them one at a time with a short delay (the "they're typing several texts in a row" / DMing feel). But when the conversation has multiple characters, that staggering is gone — every character's messages pop in all at once.

How to reproduce (try it yourself)

  1. Conversation mode, one character. Send something that gets a multi-part reply.
    You'll see: the parts appear staggered, ~1.5s apart.
  2. Conversation mode, a group with two+ characters. Send something both reply to.
    You'll see: all messages from both characters appear simultaneously, no stagger.
    Expected: multi-character replies stagger their messages too (the same DMing feel), instead of dumping them all at once.

Where it is (all client-side — the server sends one merged reply; pacing is purely in the UI)

There are two separate stagger mechanisms, and group replies fall into the broken one:

  • Single character (works): packages/client/src/components/chat/ConversationView.tsx builds contentParts only when the message is not group-formatted — hasGroupFormat = msg.content.includes("<speaker=") || hasNamePrefixFormat(...), and contentParts is built only if (… && !hasGroupFormat) (lines 578-588). A useLayoutEffect over the list then reveals those parts one at a time with an i * 1500ms timer loop (the freshness-gated reveal around ConversationView.tsx:741-873, applied via the visiblePartCount prop).
  • Multiple characters (broken): a group reply is saved as one merged message with Name: prefixes per speaker, so hasGroupFormat is true → contentParts stays undefined → the single-character stagger above never runs for it. Group messages instead render through the grouped-segment path (ConversationMessageGrouped.tsx / ConversationMessageBubble.tsx, each .slice(0, visibleSegments)), whose own stagger lives in packages/client/src/components/chat/ConversationMessage.tsx:384-411:
    const [visibleSegments, setVisibleSegments] = useState(segmentCount); // starts at FULL count
    useEffect(() => {
      if (initialRenderRef.current) { initialRenderRef.current = false; setVisibleSegments(segmentCount); return; } // fresh mount → show ALL
      if (renderedContent !== prevContentRef.current && segmentCount > 1) { setVisibleSegments(1); /* i*1500ms reveal */ }
      …
    }, [renderedContent, segmentCount]);
    
    It initializes visibleSegments to the full count and only staggers when renderedContent changes after the first render. A brand-new reply mounts already-complete (the live stream is a separate row that gets replaced by the final saved row), so initialRenderRef is true, all segments show immediately, and the stagger only ever fires later on an in-place edit/regeneration.

What's happening

Single-character replies have no name prefixes, so the list splits them into contentParts and drip-reveals them on arrival. Multi-character replies arrive as one merged, name-prefixed message, which disables that split and routes rendering to the grouped-segment component — whose stagger is written to trigger only on a content change after mount, not on first appearance. So a fresh group reply shows every speaker's segment at once.

Suggested fix

Make the grouped-segment path stagger on first appearance, mirroring the single-character path. In ConversationMessage.tsx:384-411, don't initialize visibleSegments to the full count for a freshly-arrived assistant message — start at 1 and run the same i * 1500ms reveal on initial mount, gated on a freshness signal so messages loaded from history (or re-mounted on scroll) still render fully and don't re-stagger. The clean way is to reuse the freshness / seen-keys gating the single-character path already has in ConversationView.tsx (~779-812) — hoist the group stagger into that same list-level effect, or pass a freshlyArrived / visibleSegmentCount prop down to ConversationMessage (analogous to the existing visiblePartCount), rather than relying on the in-component "content changed after mount" heuristic. (Applies to both classic and bubble styles, since both grouped renderers use the same visibleSegments initialization.)


AI-investigated against the current tree (v2.0.9); the two stagger paths and the fresh-mount "show all" behavior read and confirmed. Reported on v2.0.8. Static analysis (not run live) — please verify before fixing.

Originally created by @kolacheee on GitHub (Jun 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3121 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** In Conversation mode, a single-character reply that splits into several "messages" reveals them one at a time with a short delay (the "they're typing several texts in a row" / DMing feel). But when the conversation has **multiple** characters, that staggering is gone — every character's messages pop in all at once. **How to reproduce (try it yourself)** 1. Conversation mode, **one** character. Send something that gets a multi-part reply. **You'll see:** the parts appear staggered, ~1.5s apart. 2. Conversation mode, a group with **two+** characters. Send something both reply to. **You'll see:** all messages from both characters appear simultaneously, no stagger. **Expected:** multi-character replies stagger their messages too (the same DMing feel), instead of dumping them all at once. **Where it is** (all client-side — the server sends one merged reply; pacing is purely in the UI) There are two separate stagger mechanisms, and group replies fall into the broken one: - **Single character (works):** `packages/client/src/components/chat/ConversationView.tsx` builds `contentParts` only when the message is **not** group-formatted — `hasGroupFormat = msg.content.includes("<speaker=") || hasNamePrefixFormat(...)`, and `contentParts` is built only `if (… && !hasGroupFormat)` (lines 578-588). A `useLayoutEffect` over the list then reveals those parts one at a time with an `i * 1500ms` timer loop (the freshness-gated reveal around `ConversationView.tsx:741-873`, applied via the `visiblePartCount` prop). - **Multiple characters (broken):** a group reply is saved as **one merged message** with `Name:` prefixes per speaker, so `hasGroupFormat` is `true` → `contentParts` stays `undefined` → the single-character stagger above never runs for it. Group messages instead render through the grouped-segment path (`ConversationMessageGrouped.tsx` / `ConversationMessageBubble.tsx`, each `.slice(0, visibleSegments)`), whose own stagger lives in `packages/client/src/components/chat/ConversationMessage.tsx:384-411`: ```ts const [visibleSegments, setVisibleSegments] = useState(segmentCount); // starts at FULL count useEffect(() => { if (initialRenderRef.current) { initialRenderRef.current = false; setVisibleSegments(segmentCount); return; } // fresh mount → show ALL if (renderedContent !== prevContentRef.current && segmentCount > 1) { setVisibleSegments(1); /* i*1500ms reveal */ } … }, [renderedContent, segmentCount]); ``` It initializes `visibleSegments` to the full count and only staggers when `renderedContent` changes **after** the first render. A brand-new reply mounts already-complete (the live stream is a separate row that gets replaced by the final saved row), so `initialRenderRef` is true, all segments show immediately, and the stagger only ever fires later on an in-place edit/regeneration. **What's happening** Single-character replies have no name prefixes, so the list splits them into `contentParts` and drip-reveals them on arrival. Multi-character replies arrive as one merged, name-prefixed message, which disables that split and routes rendering to the grouped-segment component — whose stagger is written to trigger only on a content change after mount, not on first appearance. So a fresh group reply shows every speaker's segment at once. **Suggested fix** Make the grouped-segment path stagger on first appearance, mirroring the single-character path. In `ConversationMessage.tsx:384-411`, don't initialize `visibleSegments` to the full count for a freshly-arrived assistant message — start at 1 and run the same `i * 1500ms` reveal on initial mount, **gated on a freshness signal** so messages loaded from history (or re-mounted on scroll) still render fully and don't re-stagger. The clean way is to reuse the freshness / seen-keys gating the single-character path already has in `ConversationView.tsx` (~779-812) — hoist the group stagger into that same list-level effect, or pass a `freshlyArrived` / `visibleSegmentCount` prop down to `ConversationMessage` (analogous to the existing `visiblePartCount`), rather than relying on the in-component "content changed after mount" heuristic. (Applies to both classic and bubble styles, since both grouped renderers use the same `visibleSegments` initialization.) --- *AI-investigated against the current tree (v2.0.9); the two stagger paths and the fresh-mount "show all" behavior read and confirmed. Reported on v2.0.8. Static analysis (not run live) — please verify before fixing.*
bsakaguchi 2026-10-21 05:41:34 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jul 2, 2026):

Codex is taking this in branch codex/issue-sweep-3119-3135 for a staging-targeted fix sweep.

<!-- gh-comment-id:4864514394 --> @SpicyMarinara commented on GitHub (Jul 2, 2026): Codex is taking this in branch codex/issue-sweep-3119-3135 for a staging-targeted fix sweep.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 2, 2026):

Fix is ready in PR #3138 with CI passing. This issue will close automatically when the PR merges into staging.

<!-- gh-comment-id:4864746521 --> @SpicyMarinara commented on GitHub (Jul 2, 2026): Fix is ready in PR #3138 with CI passing. This issue will close automatically when the PR merges into staging.
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#1673
No description provided.