[PR #505] [CLOSED] fix(chat): prevent duplicate assistant bubble while finalizing #4645

Closed
opened 2026-10-22 04:09:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/505
Author: @Xelvanis
Created: 5/7/2026
Status: ❌ Closed

Base: main ← Head: fix/assistant-finalizing-duplicate


📝 Commits (1)

  • 631a7c5 fix(chat): prevent duplicate assistant bubble while finalizing

📊 Changes

4 files changed (+33 additions, -6 deletions)

View changed files

📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+4 -1)
📝 packages/client/src/components/chat/ConversationView.tsx (+6 -1)
📝 packages/client/src/hooks/use-generate.ts (+8 -4)
📝 packages/client/src/stores/chat.store.ts (+15 -0)

📄 Description

Track the saved streaming message id and hide the temporary streaming indicator once the persisted message is present in the message list. This keeps the React Query to Zustand handoff from rendering both copies at once.

Linked issue

I've been seeing duplicate assistant messages during response streaming in roleplay chat the last couple of days, but haven't seen anyone else report this bug.

Closes #

Why this change

  • Fixes a duplicate assistant response bubble that could appear briefly while a streamed message was finalizing and being refreshed from the database.

What changed

  • Added per-chat tracking for the saved message that replaces the temporary streaming bubble.
  • Updated generation handling so streamed message_saved events record the persisted message ID instead of immediately showing a duplicate saved copy.
  • Updated conversation and roleplay renderers to hide the temporary streaming bubble once the real saved message appears.
  • Kept regeneration behavior unchanged.

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

  • Automated validation run: pnpm check passed locally.
  • Sent message in roleplay chat and verified duplicate message no longer appears.
  • Manually tested Conversation mode streaming: no duplicate final assistant bubble observed.
  • Noted a brief multi-line reveal flash in Conversation mode before staggered line reveal begins; this appears related to existing Conversation line-stagger behavior and is not addressed by this PR.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed an issue where the streaming indicator would duplicate when switching between chats or reloading the page. The streaming message placeholder now correctly displays only once per response, preventing duplicate content in the conversation.

🔄 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/505 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/assistant-finalizing-duplicate` --- ### 📝 Commits (1) - [`631a7c5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/631a7c5fd8e6a50a990109d6441ca6b979589da2) fix(chat): prevent duplicate assistant bubble while finalizing ### 📊 Changes **4 files changed** (+33 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+4 -1) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+6 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+8 -4) 📝 `packages/client/src/stores/chat.store.ts` (+15 -0) </details> ### 📄 Description Track the saved streaming message id and hide the temporary streaming indicator once the persisted message is present in the message list. This keeps the React Query to Zustand handoff from rendering both copies at once. ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> I've been seeing duplicate assistant messages during response streaming in roleplay chat the last couple of days, but haven't seen anyone else report this bug. Closes # ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Fixes a duplicate assistant response bubble that could appear briefly while a streamed message was finalizing and being refreshed from the database. ## What changed <!-- List the key changes in this PR --> - Added per-chat tracking for the saved message that replaces the temporary streaming bubble. - Updated generation handling so streamed `message_saved` events record the persisted message ID instead of immediately showing a duplicate saved copy. - Updated conversation and roleplay renderers to hide the temporary streaming bubble once the real saved message appears. - Kept regeneration behavior unchanged. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [X] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [X] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [X] Above manual verification completed (describe below) - [X] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Automated validation run: `pnpm check` passed locally. - Sent message in roleplay chat and verified duplicate message no longer appears. - Manually tested Conversation mode streaming: no duplicate final assistant bubble observed. - Noted a brief multi-line reveal flash in Conversation mode before staggered line reveal begins; this appears related to existing Conversation line-stagger behavior and is not addressed by this PR. ## Docs and release impact - [X] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings for UI changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Fixed an issue where the streaming indicator would duplicate when switching between chats or reloading the page. The streaming message placeholder now correctly displays only once per response, preventing duplicate content in the conversation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:26 +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#4645
No description provided.