The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor: trim verbose comments + drop redundant default_flow_style kwarg
kshitija6e1e270b110
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex a95484d3386..c0cf2a9e8a2 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -870,17 +870,12 @@ def write_profile_meta(existing["description"] = description.strip()if description_auto is not None:existing["description_auto"] = bool(description_auto)- # Route through the shared atomic helper (temp file + fsync + replace).- # A bare ``open(path, "w")`` truncates before the dump, so a crash or- # SIGINT mid-write leaves profile.yaml empty or half-written. The read- # half above swallows the resulting parse error and falls back to- # ``{}``, so the NEXT call would silently and permanently drop every- # field the caller did not pass — breaking this function's documented- # merge contract. atomic_yaml_write also emits emoji descriptions as- # real UTF-8 rather than ``\UXXXXXXXX`` escapes (GitHub #51356).+ # Atomic write: bare open("w") truncates before the dump, and the read+ # path above swallows parse errors as {}, so a crashed write would+ # silently drop unspecified fields on the next call (#51356, #16743).from utils import atomic_yaml_write- atomic_yaml_write(path, existing, sort_keys=False, default_flow_style=False)+ atomic_yaml_write(path, existing, sort_keys=False)# ---------------------------------------------------------------------------diff --git a/hermes_cli/skin_cmd.py b/hermes_cli/skin_cmd.pyindex 4d921ca5e4b..bde243bc48a 100644--- a/hermes_cli/skin_cmd.py+++ b/hermes_cli/skin_cmd.py@@ -72,17 +72,8 @@ def _skin_set(key: str, value: str, skin: str | None) -> int:data["colors"][key] = valuedata.setdefault("name", target)- # Route through the shared atomic helper (temp file + fsync + replace;- # it creates the parent dir and keeps allow_unicode=True for the kaomoji- # cursors and box-drawing tool prefixes). ``write_text`` truncates and- # writes with no fsync and no atomic swap, so a crash or power loss can- # leave <skin>.yaml zero-length — and ``safe_load("")`` returns ``None``,- # which the ``or {}`` above turns into an empty palette, so the next- # ``hermes skin set`` rewrites from empty and permanently drops every- # other color. (A file left with *invalid* YAML raises instead and- # aborts the command — loud, and not a loss.) The gateway's skin watcher- # repaints live surfaces from this file within ~1s, so a half-written- # file is observable, not only a crash-window concern.+ # Atomic write: write_text truncates with no fsync; safe_load("") → None+ # → {} would permanently lose the palette on the next set (#51356, #16743).from utils import atomic_yaml_writeatomic_yaml_write(path, data, sort_keys=False)