This fixes the asyncpg.exceptions.CharacterNotInRepertoireError that occurs when tool returns contain null bytes (0x00), which PostgreSQL TEXT columns reject in UTF-8 encoding. Changes: - Add sanitize_null_bytes() function to recursively remove null bytes from strings - Update json_dumps() to sanitize data before serialization - Apply sanitization in converters.py for tool_calls, tool_returns, approvals, and message_content - Add comprehensive unit tests Fixes #8014 🤖 Generated with [Letta Code](https://letta.com) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Letta <noreply@letta.com> Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
28 KiB
28 KiB