dde7075d6c
f1ea4a56c("cover the remaining setup-time .env reads with utf-8-sig", following75afc47bafor mem0/hindsight) swept this class; openviking's _write_env_vars was missed and still reads with strict utf-8. It copies every existing line through on each update, so the read decides whether a credential update lands: BOM'd .env -> the first key never matches, so the old line survives and the new value is appended as a duplicate. .env loaders keep the first occurrence, so the update silently does nothing. cp1252 .env -> UnicodeDecodeError aborts setup outright. Read exactly like the canonical hermes_cli/config.py save_env_value (utf-8-sig + errors="replace"). A plain UTF-8 file rewrites byte-identically. Scope: hermes_cli/memory_setup.py has the same read but is already the subject of #30281 / #60587, so it is left alone here. (cherry picked from commit 175c6852c2c255b3219575b5de0b1b70f1f0efcb)