mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-26 17:38:36 +00:00
The mem0 and hindsight memory-provider setup routines round-trip the user's ~/.hermes/.env: they read existing lines, update the keys they manage, and rewrite the whole file preserving every other line verbatim. Both used env_path.read_text() / write_text() with no encoding. read_text()/write_text() with no encoding fall back to the system locale (cp1252/GBK on Windows), so on a non-UTF-8 host the preserved lines get mangled or the call crashes on any non-ASCII value, and — because the reader never strips a BOM — a Notepad-edited .env makes the first key fail the in-place match and get duplicated instead of updated. Match the canonical .env readers in hermes_cli/config.py: read with encoding='utf-8-sig' (BOM-tolerant) and write with encoding='utf-8'. mem0/_setup.py already pins utf-8 for mem0.json, so this just aligns the .env path in the same file. Fixes both memory plugins in one class fix. Adds regression tests: a BOM'd .env updates the first key in place (locale-independent, fails without the fix) and non-ASCII existing lines survive the round-trip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_byterover_provider.py | ||
| test_config_schema.py | ||
| test_hindsight_config_schema.py | ||
| test_hindsight_provider.py | ||
| test_holographic_auto_extract.py | ||
| test_holographic_retrieval.py | ||
| test_holographic_shutdown_closes_db.py | ||
| test_holographic_store.py | ||
| test_honcho_config_schema.py | ||
| test_mem0_backend.py | ||
| test_mem0_providers.py | ||
| test_mem0_setup.py | ||
| test_mem0_v3.py | ||
| test_memory_lazy_install.py | ||
| test_openviking_provider.py | ||
| test_openviking_shutdown.py | ||
| test_retaindb_provider.py | ||
| test_supermemory_provider.py | ||