debug: Fix session ID mismatch in useSessionSharing for Matrix mode

- Use Matrix room ID as session ID when in Matrix mode
- Add extensive debugging for session ID configuration
- The issue was that useSessionSharing was filtering messages by session ID
- Matrix messages use different session ID than local Goose session
- Need to align session IDs so useSessionSharing processes Matrix messages
- Added logs to track session ID matching and message processing
This commit is contained in:
spencrmartin
2025-11-14 13:25:25 -05:00
parent 90e1cf0b9f
commit 01cd09cb6b
+12 -1
View File
@@ -71,13 +71,24 @@ export default function Pair({
const [hasLoadedMatrixHistory, setHasLoadedMatrixHistory] = useState(false);
// Session sharing hook for Matrix collaboration
// In Matrix mode, we need to use a session ID that matches what's being sent in Matrix messages
const effectiveSessionId = isMatrixMode && matrixRoomId ? matrixRoomId : (chat.sessionId || 'default');
console.log('🔧 useSessionSharing configuration:', {
effectiveSessionId,
isMatrixMode,
matrixRoomId,
chatSessionId: chat.sessionId
});
const sessionSharing = useSessionSharing({
sessionId: chat.sessionId || 'default',
sessionId: effectiveSessionId,
sessionTitle: chat.title || `Matrix Collaboration ${matrixRoomId?.substring(0, 8) || 'Session'}`,
messages: chat.messages,
onMessageSync: (message) => {
// Handle synced messages from Matrix session participants
console.log('💬 Synced message from Matrix shared session:', message);
console.log('💬 Session ID match check:', { effectiveSessionId, isMatrixMode, matrixRoomId });
// Add the synced message to local chat
setChat(prevChat => ({
...prevChat,