Fix Matrix message deduplication - only mark as processed after successful display

- Moved processedMessages.current.add() to AFTER onMessageSync call
- Prevents messages from being marked as processed when they fail to display
- Fixes issue where messages were skipped due to premature deduplication
This commit is contained in:
spencrmartin
2025-11-21 15:03:43 -05:00
parent a3d371b86c
commit eaa39ca49e
+5 -2
View File
@@ -558,8 +558,7 @@ export const useSessionSharing = ({
return;
}
// Mark this message as processed
processedMessages.current.add(messageKey);
// DON'T mark as processed yet - wait until we successfully call onMessageSync
// ULTRA-STRICT SESSION MESSAGE FILTERING: Only process if ALL room IDs match exactly
const isMatrixRoom = sessionId && sessionId.startsWith('!');
@@ -678,6 +677,10 @@ export const useSessionSharing = ({
if (onMessageSync && hasExplicitMatrixRoomId) {
console.log('✅ CALLING onMessageSync FROM GOOSE SESSION SYNC - Matrix room explicitly configured');
onMessageSync(message);
// Mark as processed ONLY after successfully calling onMessageSync
processedMessages.current.add(messageKey);
console.log('✅ Marked message as processed:', messageKey);
} else {
console.log('🚫 BLOCKING onMessageSync FROM GOOSE SESSION SYNC - No explicit Matrix room configuration', {
hasOnMessageSync: !!onMessageSync,