The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): warn for all deprecated dotenv cwd entries
fangliquanflqa93f1b2becae
diff --git a/hermes_cli/config.py b/hermes_cli/config.pyindex 261566cce3c..d5372eb3fec 100644--- a/hermes_cli/config.py+++ b/hermes_cli/config.py@@ -2239,24 +2239,13 @@ def warn_deprecated_cwd_env_vars(config: Optional[Dict[str, Any]] = None) -> Nonmessaging_cwd = str(env_map.get("MESSAGING_CWD") or "").strip()terminal_cwd_env = str(env_map.get("TERMINAL_CWD") or "").strip()- if config is None:- try:- config = load_config()- except Exception:- return-- terminal_cfg = config.get("terminal", {})- config_cwd = terminal_cfg.get("cwd", ".") if isinstance(terminal_cfg, dict) else "."- # Only warn if config.yaml doesn't have an explicit path- config_has_explicit_cwd = config_cwd not in {".", "auto", "cwd", ""}-lines: list[str] = []if messaging_cwd:lines.append(f" \033[33m⚠\033[0m MESSAGING_CWD={messaging_cwd} found in .env — "f"this is deprecated.")- if terminal_cwd_env and not config_has_explicit_cwd:+ if terminal_cwd_env:lines.append(f" \033[33m⚠\033[0m TERMINAL_CWD={terminal_cwd_env} found in .env — "f"this is deprecated."diff --git a/tests/hermes_cli/test_deprecated_cwd_warning.py b/tests/hermes_cli/test_deprecated_cwd_warning.pyindex e583f2220e4..5e7212ea37c 100644--- a/tests/hermes_cli/test_deprecated_cwd_warning.py+++ b/tests/hermes_cli/test_deprecated_cwd_warning.py@@ -46,6 +46,17 @@ class TestDeprecatedCwdWarning:assert "deprecated" in captured.err.lower()assert "config.yaml" in captured.err+ def test_dotenv_terminal_cwd_warns_with_explicit_config(+ self, monkeypatch, tmp_path, capsys+ ):+ _write_env(monkeypatch, tmp_path, "TERMINAL_CWD=/legacy/path\n")++ from hermes_cli.config import warn_deprecated_cwd_env_vars++ warn_deprecated_cwd_env_vars(config={"terminal": {"cwd": "/current/path"}})++ assert "TERMINAL_CWD=/legacy/path" in capsys.readouterr().err+def test_commented_and_empty_dotenv_values_do_not_warn(self, monkeypatch, tmp_path, capsys):