Bug Description
Every message response in Claudia is processed twice, resulting in double token consumption and duplicate
messages in the chat.
Root Cause
In src/components/ClaudeCodeSession.tsx:
- Line 623: Comment states "REMOVED: Deduplication logic - was blocking messages"
- Lines 532-533: Comment states "REMOVED: processedMessages Set - was blocking legitimate messages
after first message. We'll accept duplicates rather than block all messages"
The deduplication logic was removed to fix a different bug where messages were being blocked. However,
this created a new issue where both generic and session-specific event listeners process the same messages
during the listener transition period.
Steps to Reproduce
- Open Claudia and start a Claude Code session
- Send any message
- Observe the response is processed twice
- Check token usage - it's doubled
Expected Behavior
Each message should be processed once
Actual Behavior
Messages are processed by both the generic event listener and the session-specific event listener,
causing:
- Duplicate messages in UI (or duplicate processing)
- Double token consumption
- Increased API costs
Environment
- Version: Commit
246e0c8 (current main branch as of Oct 20, 2025)
- OS: Linux (WSL2 Ubuntu)
- Claude Code Version: 2.0.22
Suggested Fix
Implement UUID-based deduplication instead of payload-based deduplication. This would:
- Prevent duplicate processing (by tracking message UUIDs)
- Not block legitimate messages (UUIDs are unique per message)
- Work across the generic→session-specific listener transition
Example implementation:
// Track processed message UUIDs
const processedMessageUuids = new Set<string>();
function handleStreamMessage(payload: string) {
const message = JSON.parse(payload) as ClaudeStreamMessage;
// Deduplicate by UUID if available
if (message.uuid) {
if (processedMessageUuids.has(message.uuid)) {
console.log('Skipping duplicate message:', message.uuid);
return;
}
processedMessageUuids.add(message.uuid);
}
// Continue processing...
}
Related Commits
- Commit d51ae24 (Aug 6, 2025): "made changes to session creation flow and fixed duplicate tab opening"
- This fixed duplicate tabs but the deduplication removal may have caused duplicate messages
Impact
- High - Affects all users
- Doubles token costs for every conversation
- Makes Claudia expensive to use
Thank you for this excellent project!
Bug Description
Every message response in Claudia is processed twice, resulting in double token consumption and duplicate
messages in the chat.
Root Cause
In
src/components/ClaudeCodeSession.tsx:after first message. We'll accept duplicates rather than block all messages"
The deduplication logic was removed to fix a different bug where messages were being blocked. However,
this created a new issue where both generic and session-specific event listeners process the same messages
during the listener transition period.
Steps to Reproduce
Expected Behavior
Each message should be processed once
Actual Behavior
Messages are processed by both the generic event listener and the session-specific event listener,
causing:
Environment
246e0c8(current main branch as of Oct 20, 2025)Suggested Fix
Implement UUID-based deduplication instead of payload-based deduplication. This would:
Example implementation: