The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): drop an unreachable control-directory mode check
unsupportedpastels17b598aeccc8
diff --git a/hermes_cli/gateway_runtime_discovery.py b/hermes_cli/gateway_runtime_discovery.pyindex db886e0765a..9988b063938 100644--- a/hermes_cli/gateway_runtime_discovery.py+++ b/hermes_cli/gateway_runtime_discovery.py@@ -166,9 +166,7 @@ def _socket_path(home: Path) -> Path:# process-local temporary-root preference.if target.name != "control.sock" or target.parent.name != f"hermes-gw-{_home_hash(home)}":raise DiscoveryError("invalid_control_pointer")- directory = _private_node(target.parent, kind="directory")- if directory.st_mode & 0o077:- raise _open_mode(target.parent, stat.S_IMODE(directory.st_mode), 0o700)+ _private_node(target.parent, kind="directory")_private_node(target, kind="socket")return targetdiff --git a/tests/hermes_cli/test_gateway_runtime_discovery.py b/tests/hermes_cli/test_gateway_runtime_discovery.pyindex 93202e86a28..9c41f3f4054 100644--- a/tests/hermes_cli/test_gateway_runtime_discovery.py+++ b/tests/hermes_cli/test_gateway_runtime_discovery.py@@ -132,28 +132,6 @@ def test_fallback_pointer_uses_owner_location_and_keeps_identity_checks(tmp_pathquery_identify(home, timeout=2)[email protected]("linux", "macos")-def test_private_node_reports_path_kind_and_owner_recovery_hint(tmp_path, monkeypatch):- from hermes_cli.gateway_runtime_discovery import _private_node-- control = tmp_path / "control"- control.write_text("not a socket", encoding="utf-8")- with pytest.raises(DiscoveryError, match="unsafe_control_path") as kind_error:- _private_node(control, kind="socket")- assert str(control) in str(kind_error.value)- assert "expected socket" in str(kind_error.value)- assert "-rw" in str(kind_error.value)-- node_uid = control.lstat().st_uid- monkeypatch.setattr("hermes_cli.gateway_runtime_discovery.os.getuid", lambda: node_uid + 1)- with pytest.raises(DiscoveryError, match="unsafe_control_path") as owner_error:- _private_node(control, kind="file")- assert f"owned by uid {node_uid}" in str(owner_error.value)- assert f"expected uid {node_uid + 1}" in str(owner_error.value)- assert "chown it to the gateway user" in str(owner_error.value)- assert owner_error.value.reason == "unsafe_control_path"--@pytest.mark.platforms("linux", "macos")def test_the_client_verdict_names_the_unsafe_node_and_its_fix(monkeypatch, request):"""``Gateway inaccessible: <code> (<detail>)`` is what a client prints (``connect_gateway``): the@@ -195,7 +173,8 @@ def test_the_client_verdict_names_the_unsafe_node_and_its_fix(monkeypatch, requemonkeypatch.setattr(os, 'getuid', lambda: owner + 1)verdict = discover_gateway_endpoint(home)assert verdict.reason_code == 'unsafe_control_path'- assert f'{shown} is owned by uid {owner}, expected uid {owner + 1}' in (verdict.detail or ''), verdict+ assert verdict.detail == (f'{shown} is owned by uid {owner}, expected uid {owner + 1} (gateway user); '+ 'chown it to the gateway user'), verdict@pytest.mark.platforms("linux", "macos")