a digital person for bluesky

Fix X bot rejecting mentions without conversation_id

**Problem:**
- X API sometimes doesn't include conversation_id for replies
- Bot was rejecting these mentions and moving them to errors
- This was preventing void from responding to many valid mentions

**Solution:**
- When conversation_id is None, use referenced tweet ID as conversation root
- For replies, extract the replied_to tweet ID and use it for thread context
- If no referenced tweets, treat mention as standalone (use mention ID itself)
- Changed from hard rejection (return None) to graceful fallback

**Result:**
- Bot now handles replies without conversation_id properly
- Thread context can still be retrieved using the referenced tweet
- No valid mentions are rejected due to missing conversation_id

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+12 -2
+12 -2
x.py
··· 1408 1408 logger.info(f" Reference {i+1}: {ref.get('type')} -> {ref.get('id')}") 1409 1409 logger.info(f" Text preview: {mention_text[:100]}...") 1410 1410 1411 + # If no conversation_id, try to use referenced tweet as conversation root 1412 + if not conversation_id and referenced_tweets: 1413 + # For replies, use the tweet being replied to as conversation root 1414 + for ref in referenced_tweets: 1415 + if ref.get('type') == 'replied_to': 1416 + conversation_id = ref.get('id') 1417 + logger.info(f"📎 No conversation_id, using replied_to tweet {conversation_id} as conversation root") 1418 + break 1419 + 1411 1420 if not conversation_id: 1412 - logger.warning(f"❌ No conversation_id found for mention {mention_id} - this may cause thread context issues") 1413 - return None 1421 + # If still no conversation ID, use the mention itself as a standalone 1422 + conversation_id = mention_id 1423 + logger.warning(f"⚠️ No conversation_id found for mention {mention_id} - treating as standalone tweet") 1414 1424 1415 1425 # Get thread context with caching enabled for efficiency 1416 1426 # Use mention_id as until_id to exclude tweets that occurred after this mention