Skip to content

Messages duplicate on channel switch / WebSocket reconnect #31

@kagura-agent

Description

@kagura-agent

Bug

When switching channels or when the WebSocket reconnects, messages appear duplicated — identical pairs of user/assistant messages.

Root Cause

sendAllChannelHistory() sends historical messages using the same type: 'message' event as real-time new messages. The frontend App.tsx appends every message event to state without dedup.

On reconnect, history is re-sent → messages double.

Fix Options

  1. Frontend dedup: check message id before appending
  2. Server: use a distinct channel_history batch event (not individual message events)
  3. Frontend: clear channel messages on reconnect before loading history

Option 2 is cleanest — separates history from live messages.

Steps to Reproduce

  1. Open Workshop UI
  2. Send some messages in a channel
  3. Switch to another channel and back
  4. Messages appear duplicated

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions