The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): refuse to write when config.yaml has YAML syntax errors
Baophan00df09a90cd6f4
diff --git a/hermes_cli/config.py b/hermes_cli/config.pyindex 8419ba25f99..94f914d0cf9 100644--- a/hermes_cli/config.py+++ b/hermes_cli/config.py@@ -4837,8 +4837,15 @@ def set_config_value(key: str, value: str, force: bool = False):try:with open(config_path, encoding="utf-8") as f:user_config = fast_safe_load(f) or {}- except Exception:- user_config = {}+ except Exception as exc:+ print(+ f"✗ Cannot parse {config_path}: {exc}\n"+ f" The file contains a YAML syntax error. Fix the error\n"+ f" in your config file first, then retry.\n"+ f" (hermes config edit will open it in your editor.)",+ file=sys.stderr,+ )+ sys.exit(1)# Handle nested keys (e.g., "tts.provider") including numeric list# indices (e.g., "custom_providers.0.api_key"). Delegates to@@ -5045,8 +5052,15 @@ def unset_config_value(key: str):try:with open(config_path, encoding="utf-8") as f:user_config = fast_safe_load(f) or {}- except Exception:- user_config = {}+ except Exception as exc:+ print(+ f"✗ Cannot parse {config_path}: {exc}\n"+ f" The file contains a YAML syntax error. Fix the error\n"+ f" in your config file first, then retry.\n"+ f" (hermes config edit will open it in your editor.)",+ file=sys.stderr,+ )+ sys.exit(1)removed = _unset_nested(user_config, key)