Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions hermes_cli/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -6147,16 +6147,6 @@ def _gateway_command_inner(args):
sys.exit(1)

elif subcmd == "stop":
# Defense: refuse self-targeting gateway stop from inside the gateway.
# Prevents agent-initiated kill loops when combined with supervisor KeepAlive.
if os.getenv("_HERMES_GATEWAY") == "1":
print_error(
"Refusing to stop the gateway from inside the gateway process.\n"
"This command was blocked to prevent restart loops.\n"
"Use `hermes gateway stop` from a shell outside the running gateway."
)
sys.exit(1)

stop_all = getattr(args, "all", False)
system = getattr(args, "system", False)

Expand Down Expand Up @@ -6240,16 +6230,6 @@ def _gateway_command_inner(args):
print(f"✓ Stopped {get_service_name()} service")

elif subcmd == "restart":
# Defense: refuse self-targeting gateway restart from inside the gateway.
# Prevents agent-initiated kill loops when combined with supervisor KeepAlive.
if os.getenv("_HERMES_GATEWAY") == "1":
print_error(
"Refusing to restart the gateway from inside the gateway process.\n"
"This command was blocked to prevent restart loops.\n"
"Use `hermes gateway restart` from a shell outside the running gateway."
)
sys.exit(1)

# Try service first, fall back to killing and restarting
service_available = False
system = getattr(args, "system", False)
Expand Down