hermes-agent/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
..
byterover fix: add explicit UTF-8 encoding to all subprocess text=True calls (#53428) 2026-07-24 11:45:57 -07:00
hindsight fix(hindsight): specify UTF-8 encoding for file I/O on Windows 2026-07-24 17:10:39 -07:00
holographic fix(memory): preserve genuine pre-delimiter content in merged compaction rows 2026-07-22 06:59:14 -07:00
honcho fix(core,cli,gateway,plugins): add encoding='utf-8' to read_text() calls 2026-07-24 17:10:39 -07:00
mem0 fix(memory): read/write .env as UTF-8 in mem0 and hindsight setup 2026-07-24 17:10:39 -07:00
openviking fix(openviking): cool down failed refreshes and publish conn identity atomically 2026-07-24 13:00:53 +05:30
retaindb fix(memory): guard local uploads against credential reads 2026-07-05 03:14:49 -07:00
supermemory fix(supermemory): complete self-hosted endpoint routing 2026-07-20 00:40:40 -07:00
__init__.py fix(dashboard): keep memory.provider in the config schema so Desktop's dropdown survives (#63886) 2026-07-13 18:56:51 -07:00
config_schema.py revert(memory): drop the provider actions extension point 2026-07-10 15:41:52 -04:00
query_rewrite.py fix(honcho): enforce recall latency and budget contracts 2026-07-16 12:48:48 -07:00