A React Native app for the ultimate thinking partner.

debug: add logging to diagnose tool call grouping issue

Adds console logging to trace:
- How messages are being grouped by ID
- Whether tool calls/returns are in the same group
- isStreaming state and streaming group creation

This will help diagnose why tool returns appear orphaned and why
some messages show present tense ('is updating') instead of past
tense ('updated').

+17
+17
src/hooks/useMessageGroups.ts
··· 136 136 groupedById.get(msg.id)!.push(msg); 137 137 } 138 138 139 + // DEBUG: Log message grouping 140 + console.log('[useMessageGroups] Message groups by ID:'); 141 + for (const [id, msgs] of Array.from(groupedById.entries())) { 142 + const types = msgs.map(m => m.message_type).join(', '); 143 + console.log(` ID ${id}: [${types}]`); 144 + 145 + // Check for tool calls/returns 146 + const hasToolCall = msgs.some(m => m.message_type === 'tool_call_message'); 147 + const hasToolReturn = msgs.some(m => m.message_type === 'tool_return_message'); 148 + if (hasToolCall || hasToolReturn) { 149 + console.log(` -> tool_call: ${hasToolCall}, tool_return: ${hasToolReturn}`); 150 + } 151 + } 152 + 139 153 // Step 4: Convert each ID group to MessageGroup 140 154 const groups: MessageGroup[] = []; 141 155 ··· 154 168 }); 155 169 156 170 // Step 6: Append streaming group if active 171 + console.log(`[useMessageGroups] isStreaming: ${isStreaming}, streamingState:`, streamingState); 157 172 if (isStreaming && streamingState) { 158 173 const streamingGroup = createStreamingGroup(streamingState); 159 174 if (streamingGroup) { 175 + console.log('[useMessageGroups] Adding streaming group:', streamingGroup.groupKey); 160 176 groups.push(streamingGroup); 161 177 } 162 178 } 163 179 180 + console.log(`[useMessageGroups] Final groups: ${groups.length} total`); 164 181 return groups; 165 182 }, [messages, isStreaming, streamingState]); 166 183 }