Skip to content

The agent that grows with you

fix(footguns): restore utf-8 on 4 write sites over-converted to utf-8-sig

ethernet09a637c1436f
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index 683f0d9801b..878af6bd069 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -576,7 +576,7 @@ def _file_lock(
lock_path.write_text(" ", encoding="utf-8")
except (OSError, PermissionError):
pass
- lock_file = stack.enter_context(lock_path.open("r+" if msvcrt else "a+", encoding="utf-8-sig"))
+ lock_file = stack.enter_context(lock_path.open("r+" if msvcrt else "a+", encoding="utf-8"))
deadline = time.monotonic() + max(1.0, timeout_seconds)
while True:
try:
diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py
index 2211b3ea161..cafe87c5d70 100644
--- a/hermes_cli/gateway.py
+++ b/hermes_cli/gateway.py
@@ -3482,7 +3482,7 @@ def _append_launchd_reload_log(message: str) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
from datetime import datetime as _dt
stamp = _dt.now().astimezone().strftime("%Y-%m-%d %H:%M:%S %z")
- with path.open("a", encoding="utf-8-sig") as fh:
+ with path.open("a", encoding="utf-8") as fh:
fh.write(f"[{stamp}] {message}\n")
except OSError:
pass
diff --git a/hermes_cli/update_cmd_maint.py b/hermes_cli/update_cmd_maint.py
index 2068d3cc36d..85588ba3682 100644
--- a/hermes_cli/update_cmd_maint.py
+++ b/hermes_cli/update_cmd_maint.py
@@ -636,7 +636,7 @@ def _ensure_fhs_path_guard() -> None:
):
continue
try:
- with cfg.open("a", encoding="utf-8-sig") as f:
+ with cfg.open("a", encoding="utf-8") as f:
f.write("\n" + path_comment + "\n" + path_line + "\n")
except OSError as e:
print(f" ⚠ Could not update {cfg}: {e}")
diff --git a/plugins/platforms/a2a/protocol.py b/plugins/platforms/a2a/protocol.py
index c8cf8642929..d6962a5b0ed 100644
--- a/plugins/platforms/a2a/protocol.py
+++ b/plugins/platforms/a2a/protocol.py
@@ -445,7 +445,7 @@ def persist_message(context_id: str, role: str, text: str, task_id: str = "") ->
try:
path = _conv_path(context_id)
path.parent.mkdir(parents=True, exist_ok=True)
- with path.open("a", encoding="utf-8-sig") as fh:
+ with path.open("a", encoding="utf-8") as fh:
fh.write(json.dumps({"ts": time.time(), "role": role, "text": text, "task_id": task_id}, ensure_ascii=False) + "\n")
except Exception:
pass