a digital person for bluesky

Improve error_message diagnostics from Letta agent

Extract useful attributes from error_message chunks instead of
logging the unhelpful default string representation. Dumps all
non-None attributes if standard fields are empty.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

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

Changed files
+28 -1
+28 -1
bsky.py
··· 588 588 # Indent response text 589 589 for line in chunk.content.split('\n'): 590 590 print(f" {line}") 591 + elif chunk.message_type == 'error_message': 592 + # Extract all available error info 593 + error_details = [] 594 + for attr in ['content', 'message', 'error', 'reason', 'details', 'run_id', 'step_id']: 595 + val = getattr(chunk, attr, None) 596 + if val: 597 + error_details.append(f"{attr}={val}") 598 + if error_details: 599 + logger.error(f"Agent error: {', '.join(error_details)}") 600 + else: 601 + # Dump all non-None attributes 602 + all_attrs = {k: v for k, v in vars(chunk).items() if v is not None and not k.startswith('_')} 603 + logger.error(f"Agent error (raw): {all_attrs}") 604 + # Also log full object at debug level 605 + logger.debug(f"Full error_message: {chunk}") 591 606 else: 592 607 # Filter out verbose message types 593 608 if chunk.message_type not in ['usage_statistics', 'stop_reason']: ··· 1615 1630 print(" โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€") 1616 1631 for line in chunk.content.split('\n'): 1617 1632 print(f" {line}") 1618 - 1633 + elif chunk.message_type == 'error_message': 1634 + # Extract all available error info 1635 + error_details = [] 1636 + for attr in ['content', 'message', 'error', 'reason', 'details', 'run_id', 'step_id']: 1637 + val = getattr(chunk, attr, None) 1638 + if val: 1639 + error_details.append(f"{attr}={val}") 1640 + if error_details: 1641 + logger.error(f"Synthesis error: {', '.join(error_details)}") 1642 + else: 1643 + all_attrs = {k: v for k, v in vars(chunk).items() if v is not None and not k.startswith('_')} 1644 + logger.error(f"Synthesis error (raw): {all_attrs}") 1645 + 1619 1646 if str(chunk) == 'done': 1620 1647 break 1621 1648