Skip to content

fix(chat): prevent duplicate user message bubble#115

Closed
dimakis wants to merge 1 commit intomainfrom
fix/duplicate-user-message
Closed

fix(chat): prevent duplicate user message bubble#115
dimakis wants to merge 1 commit intomainfrom
fix/duplicate-user-message

Conversation

@dimakis
Copy link
Copy Markdown
Owner

@dimakis dimakis commented Apr 6, 2026

Summary

  • Initial user prompt was rendered twice because query-loop.ts emitted user_message to the WebSocket (via emit()) while the client had already rendered it optimistically via USER_SEND
  • The dedup check in useChatMessages.ts compared messageId, but client used user-* format while server used umsg-* — so dedup failed
  • Fix: switch to direct store.append() so the initial prompt is persisted for session restore but not broadcast to the live client

Test plan

  • Existing query-loop tests pass (21/21)
  • New assertion verifies user_message is NOT sent to WS for initial prompt
  • Manual: send a message in Mitzo — should see single bubble, not duplicate

🤖 Generated with Claude Code

The initial prompt was emitted to the WebSocket via `emit()` which both
persisted to the event store AND sent it to the live client. Since the
client already renders the message optimistically via USER_SEND (with a
different messageId format), the dedup check failed and the message
appeared twice.

Switch to direct `store.append()` so the initial prompt is persisted for
session restore but not broadcast to the already-rendering client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dimakis
Copy link
Copy Markdown
Owner Author

dimakis commented Apr 6, 2026

Superseded by #113 which fixes both the duplicate bubble and the vanishing/misordered prompt on reload.

@dimakis dimakis closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant