fleet-memory/hindsight-api/hindsight_api/engine/retain
Anton Evseev ef9d3a15cb
fix: sanitize null bytes from text fields before PostgreSQL insertion (#238)
* fix: sanitize null bytes from text fields before PostgreSQL insertion

Fixes 'invalid byte sequence for encoding UTF8: 0x00' error during batch retain

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

* refactor: consolidate _sanitize_text into fact_extraction module

Address review feedback: reuse existing _sanitize_text from fact_extraction
instead of duplicating in fact_storage.

The consolidated function now handles both:
- Null bytes (\x00) for PostgreSQL compatibility
- Unicode surrogates (U+D800-U+DFFF) for UTF-8/LLM API compatibility

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:16:23 +01:00
..
__init__.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
bank_utils.py feat: introduce mental models (#132) 2026-01-16 11:16:41 +01:00
chunk_storage.py feat: extensions (#54) 2025-12-22 11:05:23 +01:00
deduplication.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
embedding_processing.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
embedding_utils.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
entity_processing.py misc: add mcp integration tests and increase test coverage (#98) 2026-01-05 11:16:55 +01:00
fact_extraction.py fix: sanitize null bytes from text fields before PostgreSQL insertion (#238) 2026-01-31 09:16:23 +01:00
fact_storage.py fix: sanitize null bytes from text fields before PostgreSQL insertion (#238) 2026-01-31 09:16:23 +01:00
link_creation.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
link_utils.py feat: revisit mental models, directives and reflections (#179) 2026-01-22 17:13:16 +01:00
orchestrator.py fix: retain async with timestamp might fails (#253) 2026-01-30 14:54:32 +01:00
types.py feat: revisit mental models, directives and reflections (#179) 2026-01-22 17:13:16 +01:00