The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): an empty HERMES_CONFIG_BACKEND in .env resets a stale shell value
kshitijk4poor2f6ae9a0156d
diff --git a/hermes_cli/config_backend.py b/hermes_cli/config_backend.pyindex ecc679d7881..cc277d2b3f6 100644--- a/hermes_cli/config_backend.py+++ b/hermes_cli/config_backend.py@@ -175,7 +175,8 @@ def get_config_backend() -> ConfigBackend:if kind != "file":# A config read can run before load_hermes_dotenv() (hermes_cli.config reads at import time):# refuse only a value the launch home's .env / managed .env do not override, as that load will.- kind = (_dotenv_backend_override() or kind).strip().lower() or "file"+ override = _dotenv_backend_override() # None = no .env sets it; "" = an explicit reset to file+ kind = (kind if override is None else override).strip().lower() or "file"if kind == "file":return _FILE_BACKENDif kind == "remote":diff --git a/tests/hermes_cli/test_config_backend.py b/tests/hermes_cli/test_config_backend.pyindex aaddad32d0c..3d8c292a6af 100644--- a/tests/hermes_cli/test_config_backend.py+++ b/tests/hermes_cli/test_config_backend.py@@ -41,6 +41,13 @@ class TestSelection:(home / ".env").write_text(f"{cb.BACKEND_ENV}=file\n", encoding="utf-8")assert cb.get_config_backend().name == "file"+ def test_empty_launch_env_value_resets_a_stale_shell_value_to_file(self, home, monkeypatch):+ # ``HERMES_CONFIG_BACKEND=`` in the launch .env loads over the shell value as "", i.e. the default.+ monkeypatch.setenv("HERMES_HOME", str(home))+ monkeypatch.setenv(cb.BACKEND_ENV, "remote")+ (home / ".env").write_text(f"{cb.BACKEND_ENV}=\n", encoding="utf-8")+ assert cb.get_config_backend().name == "file"+def test_explicit_non_config_file_ignores_backend(self, home, monkeypatch):other = home / "import-source.yaml"other.write_text("a: 1\n", encoding="utf-8")