Files
hermes-agent/tests/hermes_cli/test_cli_pause_command.py
Teknium dccbdaf926 feat(slash): messaging /stop ends this chat's earlier background processes; /pause works in CLI and TUI
Messaging /stop already killed the processes of the turn it interrupted; a background process
an EARLIER turn of the same chat started survived it. /stop now also kills every running
process spawned under this chat's gateway session key (profile- and chat-namespaced, the key the
reset guard reads), on every /stop path (idle, mid-turn fast path, pending setup), and says how
many it stopped. Other chats' and profiles' processes never match. CLI /stop is unchanged.

/pause [reason] and /pause off are no longer messaging-only: the classic CLI (and the TUI's slash
worker) run the same agent.estop.pause_command, so the reply text and the global sentinel are
identical on every surface. /pause is dispatched inline while a CLI turn runs (busy_policy dispatch).
2026-11-28 19:42:51 -08:00

28 lines
1020 B
Python

"""Invariant: ``/pause [reason]`` and ``/pause off`` typed in the classic CLI (which the TUI's slash
worker runs too) engage and lift the same global emergency stop as the messaging ``/pause`` and
``hermes pause``, with the messaging reply text. On main the command was messaging-only."""
from __future__ import annotations
import pytest
from agent import estop
from agent.i18n import t
@pytest.fixture
def cli(tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
from cli import HermesCLI
return HermesCLI.__new__(HermesCLI)
def test_cli_pause_engages_and_lifts_the_global_estop(cli, capsys):
cli.process_command("/pause deploy freeze")
assert estop.get_state()["reason"] == "deploy freeze"
assert t("gateway.pause.paused", suffix=t("gateway.pause.reason_suffix", reason="deploy freeze")) \
in capsys.readouterr().out
cli.process_command("/pause off")
assert estop.is_engaged() is False
assert t("gateway.pause.resumed") in capsys.readouterr().out