mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
DEBUG: Add extensive logging to diagnose Matrix message leakage
- Added detailed logging to useSessionSharing Matrix listener setup check - Added critical debug logging to ChatInput before calling useSessionSharing - Enhanced Matrix room detection logging with timestamps - This will help identify why regular chats are still receiving Matrix messages The issue appears to be that regular chat sessions might be getting initialRoomId values when they shouldn't, causing Matrix listeners to be set up for non-Matrix chats.
This commit is contained in:
@@ -421,6 +421,15 @@ export default function ChatInput({
|
||||
}
|
||||
});
|
||||
|
||||
// CRITICAL DEBUG: Log what we're actually passing to useSessionSharing
|
||||
console.log('🚨 ChatInput: About to call useSessionSharing with:', {
|
||||
sessionId: sessionId,
|
||||
initialRoomId: actualMatrixRoomId,
|
||||
isMatrixRoom: isMatrixRoom,
|
||||
shouldSetupMatrixListeners: !!actualMatrixRoomId,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
|
||||
// Get Matrix context for current user information
|
||||
const { currentUser } = useMatrix();
|
||||
|
||||
|
||||
@@ -138,7 +138,20 @@ export const useSessionSharing = ({
|
||||
|
||||
// CRITICAL FIX: Only set up Matrix listeners if this session actually has a Matrix room
|
||||
// This prevents Matrix messages from leaking into regular chats
|
||||
if (!stateRef.current.roomId && !initialRoomId) {
|
||||
// Check both current state and initialRoomId parameter
|
||||
const currentRoomId = stateRef.current.roomId;
|
||||
const hasMatrixRoom = !!(currentRoomId || initialRoomId);
|
||||
|
||||
console.log('🔍 useSessionSharing: Matrix listener setup check:', {
|
||||
sessionId,
|
||||
currentRoomId,
|
||||
initialRoomId,
|
||||
hasMatrixRoom,
|
||||
stateIsShared: stateRef.current.isShared,
|
||||
willSetupListeners: hasMatrixRoom
|
||||
});
|
||||
|
||||
if (!hasMatrixRoom) {
|
||||
console.log('🚫 useSessionSharing: No Matrix room ID - skipping Matrix listener setup for regular chat session:', sessionId);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user