The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): correct the skin_cmd fallback comment to match the actual read path
briandevans63c0bb694e0c
diff --git a/hermes_cli/skin_cmd.py b/hermes_cli/skin_cmd.pyindex 103a4a80c4e..4d921ca5e4b 100644--- a/hermes_cli/skin_cmd.py+++ b/hermes_cli/skin_cmd.py@@ -76,11 +76,13 @@ def _skin_set(key: str, value: str, skin: str | None) -> int:# 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 the read above falls back to ``{}``- # on a parse error, so the next ``hermes skin set`` rewrites from empty- # and permanently drops the rest of the palette. 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.+ # 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.from utils import atomic_yaml_writeatomic_yaml_write(path, data, sort_keys=False)diff --git a/tests/hermes_cli/test_skin_cmd.py b/tests/hermes_cli/test_skin_cmd.pyindex d5567b6e634..09cf29422ae 100644--- a/tests/hermes_cli/test_skin_cmd.py+++ b/tests/hermes_cli/test_skin_cmd.py@@ -66,10 +66,11 @@ def test_set_persists_the_skin_durably():``write_text`` truncates and writes without ever calling ``fsync``, so apower loss or container kill right after the command "succeeds" can leave``<skin>.yaml`` zero-length. That is not transient: ``_skin_set`` is a- read-modify-write whose read half falls back to ``{}``, so the next tweak- rewrites the file from that empty state and the rest of the palette is- gone for good — and the gateway's skin watcher repaints every live- surface from this file within ~1s either way.+ read-modify-write and ``safe_load("")`` returns ``None``, which its+ ``or {}`` turns into an empty palette — so the next tweak rewrites the+ file from that empty state and the rest of the palette is gone for good.+ The gateway's skin watcher repaints every live surface from this file+ within ~1s either way."""path = _skins() / "oasis.yaml"path.write_text(