a digital person for bluesky

Handle deleted posts that return InternalServerError

Bluesky's getPostThread API sometimes returns InternalServerError
instead of NotFound for deleted posts. Now we verify with getRecord
to confirm the post is actually deleted before removing from queue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

Changed files
+19
+19
bsky.py
··· 247 247 if 'NotFound' in error_str or 'Post not found' in error_str: 248 248 logger.warning(f"Post not found for URI {uri}, removing from queue") 249 249 return True # Return True to remove from queue 250 + elif 'InternalServerError' in error_str: 251 + # Bluesky sometimes returns InternalServerError for deleted posts 252 + # Verify if post actually exists using getRecord 253 + try: 254 + parts = uri.replace('at://', '').split('/') 255 + repo, collection, rkey = parts[0], parts[1], parts[2] 256 + atproto_client.com.atproto.repo.get_record({ 257 + 'repo': repo, 'collection': collection, 'rkey': rkey 258 + }) 259 + # Post exists, this is a real server error - re-raise 260 + logger.error(f"Error fetching thread (post exists, server error): {e}") 261 + raise 262 + except Exception as verify_e: 263 + if 'RecordNotFound' in str(verify_e) or 'not found' in str(verify_e).lower(): 264 + logger.warning(f"Post deleted (verified via getRecord), removing from queue: {uri}") 265 + return True # Remove from queue 266 + # Some other verification error, re-raise original 267 + logger.error(f"Error fetching thread: {e}") 268 + raise 250 269 else: 251 270 # Re-raise other errors 252 271 logger.error(f"Error fetching thread: {e}")