The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(macos): use shared atomic_write_text for the anchor marker
kshitijk4poor9c87a7c79e9b
diff --git a/hermes_cli/macos_tcc_anchor.py b/hermes_cli/macos_tcc_anchor.pyindex 99b0d76c162..3bceddb7eca 100644--- a/hermes_cli/macos_tcc_anchor.py+++ b/hermes_cli/macos_tcc_anchor.py@@ -51,6 +51,7 @@ from pathlib import Pathfrom hermes_constants import venv_python_pathfrom hermes_cli.managed_uv import _RUNTIME_DIR_NAME+from utils import atomic_write_textlogger = logging.getLogger(__name__)@@ -164,23 +165,17 @@ def _anchor_marker(venv_bin: Path) -> Path:def _write_marker(venv_bin: Path, source_file: Path) -> None:- """Write the anchor marker atomically (write-then-rename).+ """Write the anchor marker atomically via the shared helper.A concurrent ensure (update + doctor --fix) must never observe apartially-written marker: a torn read would compare unequal and triggera spurious reinstall, and ``write_text`` alone is not atomic."""- fd, tmp_name = tempfile.mkstemp(prefix=f"{_MARKER_NAME}.", dir=str(venv_bin))- try:- with os.fdopen(fd, "w", encoding="utf-8") as fh:- fh.write(_marker_value(source_file))- os.replace(tmp_name, _anchor_marker(venv_bin))- except OSError:- try:- os.unlink(tmp_name)- except OSError:- pass- raise+ atomic_write_text(+ _anchor_marker(venv_bin),+ _marker_value(source_file),+ tmp_prefix=f"{_MARKER_NAME}.",+ )def _store_root(source_file: Path) -> Path: