[GH-ISSUE #2798] [Issue]: Convo mode: group-chat bubbles merge — multiple characters' messages render inside one bubble #1422

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

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

Summary

In Bubbles (Messenger-style) chat layout, a single assistant turn that contains replies from multiple characters renders all of those replies stacked inside one shared chat bubble, with only a tiny name label per speaker. Switching to Classic (line) layout renders the same content correctly, giving each speaker its own avatar + name + row. The defect is purely a Bubbles-style rendering branch; no content is lost.

This is most visible in Convo mode group chats (where multi-character replies are common), but the trigger is the Bubbles-style flag, not the chat mode.

Symptom & UX impact

  • A multi-speaker assistant message (e.g. two characters answering in the same turn) shows as a single bubble whose body contains all speakers' text, separated only by small (0.75rem) name labels.
  • No per-speaker avatars; the bubble shows the message's single default avatar/header.
  • Speakers visually "merge" — it reads like one long message from one character rather than a group exchange.
  • Cosmetic only: every speaker's text is still present and each segment still carries its own name label, so attribution is preserved (just visually cramped). No content is dropped.

Steps to reproduce

  1. Set chat layout to Bubbles (Messenger-style).
  2. Open a group / Convo-mode chat with 2+ characters.
  3. Generate (or load) an assistant message that contains multiple speakers in one turn — e.g. speaker-tag format or Name: text format that parseSpeakerTags / parseNamePrefixFormat resolves to multiple known character names.
  4. Observe: all speakers render inside one bubble, each with only a small name label.
  5. Switch the layout to Classic — the same message now renders one avatar + name + row per speaker (correct).

Root cause

The per-speaker "grouped" layout (ConversationMessageGrouped) is explicitly excluded for Bubbles style, so Bubbles-style multi-speaker messages fall through to ConversationMessageBubble, which renders all segments inside a single bubble container.

Trace:

  • packages/client/src/components/chat/ConversationMessage.tsx:373-381 — groupedSegments is built from the rendered content via parseSpeakerTags / parseNamePrefixFormat + groupConsecutiveSegments. A single assistant message can therefore contain multiple speaker segments.
  • packages/client/src/components/chat/ConversationMessage.tsx:764 — the grouped layout gate:
    if (groupedSegments && !editing && !isUser && !isBubbleStyle) {
      return ( <> <ConversationMessageGrouped ctx={ctx} msgRef={msgRef} /> ... </> );
    }
    
    The !isBubbleStyle clause means Bubbles-style messages never use the per-speaker grouped layout.
  • packages/client/src/components/chat/ConversationMessage.tsx:800 — Bubbles style instead renders <ConversationMessageBubble ctx={ctx} />.
  • packages/client/src/components/chat/ConversationMessageBubble.tsx:152-202 — the bubble body is a single <div class="mari-message-bubble texting-bubble texting-bubble-other …">. Inside it, :174-198 maps every grouped segment into that one bubble, giving each speaker only a 0.75rem name label (:191) and its text (:194).
  • packages/client/src/styles/globals.css:3556-3561 — .texting-bubble-other applies one solid var(--card) background, so all segments visibly share a single bubble surface.

Why this is the only source of two different characters in one bubble: cross-message grouping in packages/client/src/components/chat/ConversationView.tsx:527-533 only groups adjacent messages when current.characterId === other.characterId, so two different characters never get grouped across messages. The merged-bubble effect can only come from the single-message multi-speaker groupedSegments path above.

By contrast, ConversationMessageGrouped already does this correctly: per-segment avatar resolution at ConversationMessageGrouped.tsx:128-130, speakerless narration rendered as italic muted text at :136-145, and a full avatar + name + timestamp row per speaker at :148-199.

Suggested fix

The fix is not a simple move of ConversationMessageBubble.tsx:174-198 out of the bubble div. The bubble shell (:68-217) is built around a single avatar column (:97-116) and a single bubble (:152-202); giving each speaker its own bubble requires rebuilding the body into a vertical list of speaker rows, each with its own avatar, name, and bubble.

Preferred approach — let the grouped component own all multi-speaker rendering, including Bubbles. This avoids duplicating (and later drifting) the speaker-resolution / narration logic that already lives in ConversationMessageGrouped.

  1. Remove the Bubbles exclusion from the gate so multi-speaker messages always route to the grouped component:

    // ConversationMessage.tsx:764
    if (groupedSegments && !editing && !isUser) {
      return (
        <>
          <ConversationMessageGrouped ctx={ctx} msgRef={msgRef} />
          {reactionRow}
          {modals}
        </>
      );
    }
    
  2. Add a Bubbles rendering branch inside ConversationMessageGrouped so each speaker segment renders as its own bubble row. Pass isBubbleStyle through ctx (it is already derived in ConversationMessage.tsx) and, in the per-speaker block (ConversationMessageGrouped.tsx:148-199), when isBubbleStyle is true:

    • render segAvatar/segName (already resolved at :128-131) in the avatar column,
    • wrap each speaker's text in its own mari-message-bubble texting-bubble texting-bubble-other div,
    • render speakerless narration (:136-145) the same way it does today.

    Key correctness note: do not reuse bubbleCornerClass (computed once per message at ConversationMessage.tsx:554-568) across the multiple inner bubbles — it encodes a single message's group position and would apply the wrong rounded-corner shape to every inner bubble. Either compute a per-segment corner shape (first/middle/last within the segment list) or use a uniform rounded-2xl for inner bubbles.

Alternative (more localized, more duplication) — keep the gate as-is and rewrite ConversationMessageBubble.tsx:174-198 to emit, outside the single bubble div (:152-202), one avatar + name + bubble per segment, mirroring ConversationMessageGrouped.tsx:128-145 for avatar resolution and narration. This is more self-contained but duplicates speaker-handling logic across two components and is the more likely to drift over time, so the grouped-component approach is preferred.

Affected files

  • packages/client/src/components/chat/ConversationMessage.tsx — gate at :764 (remove !isBubbleStyle); ctx already carries isBubbleStyle.
  • packages/client/src/components/chat/ConversationMessageGrouped.tsx — add Bubbles-style per-segment bubble rendering (:148-199, narration at :136-145).
  • packages/client/src/components/chat/ConversationMessageBubble.tsx — :174-198 multi-speaker branch becomes dead for the multi-speaker case (remove or keep only the single-speaker renderedContent path); referenced for parity.
  • packages/client/src/components/chat/ConversationMessageShared.tsx — MessageRenderContext if a new flag/field is threaded (likely none needed; isBubbleStyle already present).
  • packages/client/src/styles/globals.css (:3546-3561) — referenced for bubble surface styling; may need per-segment corner classes.

Validation

  • Bubbles style, group/Convo chat: a multi-speaker assistant turn renders each speaker as its own avatar + name + bubble (no merged bubble).
  • Classic style: multi-speaker rendering unchanged (regression check).
  • Speakerless narration segments render as italic muted text in both layouts.
  • Single-speaker assistant messages in Bubbles style are unchanged.
  • User messages in Bubbles style are unchanged (right-aligned, single bubble).
  • Inner bubble corner radii look correct (no wrong bubbleCornerClass reuse across segments).
  • Mobile viewport: bubbles wrap and remain within max-width; no horizontal overflow.
  • Local llama.cpp tool-call test: generate a multi-character reply via a local model and confirm grouped bubble rendering.
  • Avatars resolve correctly per speaker (fallback initial when no avatar).
  • Streaming a multi-speaker reply in Bubbles style renders incrementally without layout breakage.
  • pnpm check passes (TypeScript + ESLint).

AI-investigated against released 2.0.0; verify before fixing.

Originally created by @kolacheee on GitHub (Jun 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2798 ## Summary In **Bubbles** (Messenger-style) chat layout, a single assistant turn that contains replies from multiple characters renders all of those replies stacked inside **one shared chat bubble**, with only a tiny name label per speaker. Switching to **Classic** (line) layout renders the same content correctly, giving each speaker its own avatar + name + row. The defect is purely a Bubbles-style rendering branch; no content is lost. This is most visible in **Convo mode** group chats (where multi-character replies are common), but the trigger is the Bubbles-style flag, not the chat mode. ## Symptom & UX impact - A multi-speaker assistant message (e.g. two characters answering in the same turn) shows as a single bubble whose body contains all speakers' text, separated only by small (`0.75rem`) name labels. - No per-speaker avatars; the bubble shows the message's single default avatar/header. - Speakers visually "merge" — it reads like one long message from one character rather than a group exchange. - Cosmetic only: every speaker's text is still present and each segment still carries its own name label, so attribution is preserved (just visually cramped). No content is dropped. ## Steps to reproduce 1. Set chat layout to **Bubbles** (Messenger-style). 2. Open a group / Convo-mode chat with 2+ characters. 3. Generate (or load) an assistant message that contains multiple speakers in one turn — e.g. speaker-tag format or `Name: text` format that `parseSpeakerTags` / `parseNamePrefixFormat` resolves to multiple known character names. 4. Observe: all speakers render inside one bubble, each with only a small name label. 5. Switch the layout to **Classic** — the same message now renders one avatar + name + row per speaker (correct). ## Root cause The per-speaker "grouped" layout (`ConversationMessageGrouped`) is explicitly **excluded** for Bubbles style, so Bubbles-style multi-speaker messages fall through to `ConversationMessageBubble`, which renders all segments inside a single bubble container. Trace: - `packages/client/src/components/chat/ConversationMessage.tsx:373-381` — `groupedSegments` is built from the rendered content via `parseSpeakerTags` / `parseNamePrefixFormat` + `groupConsecutiveSegments`. A single assistant message can therefore contain multiple speaker segments. - `packages/client/src/components/chat/ConversationMessage.tsx:764` — the grouped layout gate: ```ts if (groupedSegments && !editing && !isUser && !isBubbleStyle) { return ( <> <ConversationMessageGrouped ctx={ctx} msgRef={msgRef} /> ... </> ); } ``` The `!isBubbleStyle` clause means Bubbles-style messages **never** use the per-speaker grouped layout. - `packages/client/src/components/chat/ConversationMessage.tsx:800` — Bubbles style instead renders `<ConversationMessageBubble ctx={ctx} />`. - `packages/client/src/components/chat/ConversationMessageBubble.tsx:152-202` — the bubble body is a single `<div class="mari-message-bubble texting-bubble texting-bubble-other …">`. Inside it, `:174-198` maps every grouped segment into that one bubble, giving each speaker only a `0.75rem` name label (`:191`) and its text (`:194`). - `packages/client/src/styles/globals.css:3556-3561` — `.texting-bubble-other` applies one solid `var(--card)` background, so all segments visibly share a single bubble surface. Why this is the only source of two different characters in one bubble: cross-message grouping in `packages/client/src/components/chat/ConversationView.tsx:527-533` only groups adjacent messages when `current.characterId === other.characterId`, so two *different* characters never get grouped across messages. The merged-bubble effect can only come from the single-message multi-speaker `groupedSegments` path above. By contrast, `ConversationMessageGrouped` already does this correctly: per-segment avatar resolution at `ConversationMessageGrouped.tsx:128-130`, speakerless narration rendered as italic muted text at `:136-145`, and a full avatar + name + timestamp row per speaker at `:148-199`. ## Suggested fix The fix is **not** a simple move of `ConversationMessageBubble.tsx:174-198` out of the bubble div. The bubble shell (`:68-217`) is built around a *single* avatar column (`:97-116`) and a *single* bubble (`:152-202`); giving each speaker its own bubble requires rebuilding the body into a vertical list of speaker rows, each with its own avatar, name, and bubble. **Preferred approach — let the grouped component own all multi-speaker rendering, including Bubbles.** This avoids duplicating (and later drifting) the speaker-resolution / narration logic that already lives in `ConversationMessageGrouped`. 1. Remove the Bubbles exclusion from the gate so multi-speaker messages always route to the grouped component: ```ts // ConversationMessage.tsx:764 if (groupedSegments && !editing && !isUser) { return ( <> <ConversationMessageGrouped ctx={ctx} msgRef={msgRef} /> {reactionRow} {modals} </> ); } ``` 2. Add a Bubbles rendering branch *inside* `ConversationMessageGrouped` so each speaker segment renders as its own bubble row. Pass `isBubbleStyle` through `ctx` (it is already derived in `ConversationMessage.tsx`) and, in the per-speaker block (`ConversationMessageGrouped.tsx:148-199`), when `isBubbleStyle` is true: - render `segAvatar`/`segName` (already resolved at `:128-131`) in the avatar column, - wrap each speaker's text in its own `mari-message-bubble texting-bubble texting-bubble-other` div, - render speakerless narration (`:136-145`) the same way it does today. Key correctness note: **do not reuse `bubbleCornerClass`** (computed once per message at `ConversationMessage.tsx:554-568`) across the multiple inner bubbles — it encodes a single message's group position and would apply the wrong rounded-corner shape to every inner bubble. Either compute a per-segment corner shape (first/middle/last within the segment list) or use a uniform `rounded-2xl` for inner bubbles. **Alternative (more localized, more duplication)** — keep the gate as-is and rewrite `ConversationMessageBubble.tsx:174-198` to emit, *outside* the single bubble div (`:152-202`), one avatar + name + bubble per segment, mirroring `ConversationMessageGrouped.tsx:128-145` for avatar resolution and narration. This is more self-contained but duplicates speaker-handling logic across two components and is the more likely to drift over time, so the grouped-component approach is preferred. ## Affected files - `packages/client/src/components/chat/ConversationMessage.tsx` — gate at `:764` (remove `!isBubbleStyle`); `ctx` already carries `isBubbleStyle`. - `packages/client/src/components/chat/ConversationMessageGrouped.tsx` — add Bubbles-style per-segment bubble rendering (`:148-199`, narration at `:136-145`). - `packages/client/src/components/chat/ConversationMessageBubble.tsx` — `:174-198` multi-speaker branch becomes dead for the multi-speaker case (remove or keep only the single-speaker `renderedContent` path); referenced for parity. - `packages/client/src/components/chat/ConversationMessageShared.tsx` — `MessageRenderContext` if a new flag/field is threaded (likely none needed; `isBubbleStyle` already present). - `packages/client/src/styles/globals.css` (`:3546-3561`) — referenced for bubble surface styling; may need per-segment corner classes. ## Validation - [ ] Bubbles style, group/Convo chat: a multi-speaker assistant turn renders each speaker as its own avatar + name + bubble (no merged bubble). - [ ] Classic style: multi-speaker rendering unchanged (regression check). - [ ] Speakerless narration segments render as italic muted text in both layouts. - [ ] Single-speaker assistant messages in Bubbles style are unchanged. - [ ] User messages in Bubbles style are unchanged (right-aligned, single bubble). - [ ] Inner bubble corner radii look correct (no wrong `bubbleCornerClass` reuse across segments). - [ ] Mobile viewport: bubbles wrap and remain within max-width; no horizontal overflow. - [ ] Local llama.cpp tool-call test: generate a multi-character reply via a local model and confirm grouped bubble rendering. - [ ] Avatars resolve correctly per speaker (fallback initial when no avatar). - [ ] Streaming a multi-speaker reply in Bubbles style renders incrementally without layout breakage. - [ ] `pnpm check` passes (TypeScript + ESLint). --- *AI-investigated against released 2.0.0; verify before fixing.*
Author
Owner

@SpicyMarinara commented on GitHub (Jun 22, 2026):

Addressed in PR #2790 / commit acab1fba: grouped multi-speaker Conversation messages now route through the grouped renderer in Bubble style, with each speaker rendered as its own bubble rather than merging all speakers into one.

<!-- gh-comment-id:4772440956 --> @SpicyMarinara commented on GitHub (Jun 22, 2026): Addressed in PR #2790 / commit acab1fba: grouped multi-speaker Conversation messages now route through the grouped renderer in Bubble style, with each speaker rendered as its own bubble rather than merging all speakers into one.
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#1422
No description provided.