Skip to content

The agent that grows with you

fix(gateway): a -p profile stop with the host socket down still parks

Tekniumbd3cbe91a900
diff --git a/hermes_cli/gateway_lifecycle_guards.py b/hermes_cli/gateway_lifecycle_guards.py
index 4a6b734bda4..0cbf0e5b749 100644
--- a/hermes_cli/gateway_lifecycle_guards.py
+++ b/hermes_cli/gateway_lifecycle_guards.py
@@ -100,14 +100,8 @@ def refuse_while_sessions_live(verb: str, args, *, host_home: Optional[Path] = N
so only its work counts."""
if profile:
hint = f"hermes -p {profile} gateway {{verb}} {INTERRUPT_FLAG}"
- work = live_work(Path(host_home), profile)
- if work is None:
- # The host serving this profile is up; no answer is not "idle", so fail closed.
- lines = [f"Refusing to {verb} the gateway: profile '{profile}' did not report its live work.",
- " Retry in a moment, or interrupt whatever it is running deliberately:",
- f" {hint.format(verb=verb)}"]
- else:
- lines = _work_lines(verb, Path(host_home), work, hint)
+ # No answer (control socket down) proceeds: the park marker path exists for exactly that host.
+ lines = refusal_lines(verb, [Path(host_home)], profile=profile, flag_hint=hint)
else:
lines = refusal_lines(verb, _candidate_homes(getattr(args, "system", False)))
if not lines:
diff --git a/tests/hermes_cli/test_gateway_lifecycle_guards.py b/tests/hermes_cli/test_gateway_lifecycle_guards.py
index 6317bd873a5..a74b5534bee 100644
--- a/tests/hermes_cli/test_gateway_lifecycle_guards.py
+++ b/tests/hermes_cli/test_gateway_lifecycle_guards.py
@@ -306,16 +306,6 @@ def test_active_work_verb_counts_a_profiles_side_agent_and_reads_it_on_the_loop(
assert reads == [True], "the authority must be read inside the loop callback"
-def test_profile_stop_fails_closed_when_the_host_does_not_report(monkeypatch, capsys):
- """No answer from the host that serves the profile is not "idle": refuse unless --interrupt."""
- from hermes_cli import gateway_lifecycle_guards as guards
- monkeypatch.setattr(guards, "live_work", lambda home, profile=None: None)
- with pytest.raises(SystemExit):
- guards.refuse_while_sessions_live("stop", SimpleNamespace(interrupt=False), host_home="/h", profile="coder")
- assert "did not report its live work" in capsys.readouterr().out
- guards.refuse_while_sessions_live("stop", SimpleNamespace(interrupt=True), host_home="/h", profile="coder")
-
-
@pytest.mark.parametrize("answer", [True, False])
def test_live_sessions_ask_yes_no_on_a_terminal(monkeypatch, capsys, answer):
"""On a terminal the verb names the live work and asks; yes proceeds, no (the default) cancels."""