hermes-agent/tests/plugins/memory
solyanviktor-star 75afc47baa fix(memory): read/write .env as UTF-8 in mem0 and hindsight setup
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>
2026-07-24 17:10:39 -07:00
..
__init__.py fix: mem0 API v2 compat, prefetch context fencing, secret redaction (#5423) 2026-04-05 22:43:33 -07:00
test_byterover_provider.py fix(byterover): honor auto extract config 2026-06-27 04:04:15 -07:00
test_config_schema.py revert(memory): drop the provider actions extension point 2026-07-10 15:41:52 -04:00
test_hindsight_config_schema.py refactor(memory): move provider config schemas into their plugins 2026-07-02 16:55:39 -04:00
test_hindsight_provider.py fix(hindsight): lazy-install cloud client dependency 2026-06-19 07:36:28 -07:00
test_holographic_auto_extract.py fix(memory): preserve genuine pre-delimiter content in merged compaction rows 2026-07-22 06:59:14 -07:00
test_holographic_retrieval.py fix(memory/holographic): sanitize FTS5 queries for natural-language recall 2026-06-30 15:55:11 -07:00
test_holographic_shutdown_closes_db.py fix(memory/holographic): close DB connection on shutdown instead of leaking to GC (#54133) 2026-06-28 02:41:52 -07:00
test_holographic_store.py fix(memory): resolve() the shared-connection registry key; symlink test 2026-07-09 18:17:40 -07:00
test_honcho_config_schema.py refactor(memory): move provider config schemas into their plugins 2026-07-02 16:55:39 -04:00
test_mem0_backend.py fix(mem0): migrate legacy OSS base URL aliases 2026-07-17 13:49:29 -07:00
test_mem0_providers.py feat(mem0): v3 API, OSS mode, update/delete tools, telemetry & review fixes (#15624) 2026-06-22 12:30:47 +00:00
test_mem0_setup.py fix(memory): read/write .env as UTF-8 in mem0 and hindsight setup 2026-07-24 17:10:39 -07:00
test_mem0_v3.py fix(mem0): prune dead get_all, wire rerank config default, warn on MEM0_HOST env override 2026-07-08 01:57:11 +05:30
test_memory_lazy_install.py fix(memory): lazy-install supermemory + mem0 SDKs like honcho/hindsight 2026-06-29 00:25:36 -07:00
test_openviking_provider.py fix(openviking): serialize client refresh state 2026-07-24 13:00:53 +05:30
test_openviking_shutdown.py fix(openviking): serialize client refresh state 2026-07-24 13:00:53 +05:30
test_retaindb_provider.py fix(memory): guard local uploads against credential reads 2026-07-05 03:14:49 -07:00
test_supermemory_provider.py fix(supermemory): complete self-hosted endpoint routing 2026-07-20 00:40:40 -07:00