Skip to content
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions hermes_cli/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ def _builtin_gateway_liveness() -> Optional[bool]:
try:
if _active_cron_provider_name() != "builtin":
return True # external provider fires jobs without the gateway
# The gateway runtime lock is held for exactly the gateway's lifetime, so it
# is a more reliable "is the ticker's process alive" signal than PID scanning
# — and inside the gateway process it short-circuits to True, so the in-gateway
# cron tool never emits a false "gateway not running" (find_gateway_pids can
# transiently miss the gateway just after a restart).
from gateway.status import is_gateway_runtime_lock_active

if is_gateway_runtime_lock_active():
return True
from hermes_cli.gateway import find_gateway_pids

return bool(find_gateway_pids())
Expand Down
8 changes: 3 additions & 5 deletions tools/mcp_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2999,11 +2999,9 @@ def _stdio_children_dead(self) -> bool:
# os.kill probe below only runs when psutil is unavailable.
import psutil

if not psutil.pid_exists(pid):
continue # this one is dead
return True # alive (signal permission irrelevant for liveness)
return False # at least one child alive
return True
if psutil.pid_exists(pid):
return False # at least one child alive → not all have exited
return True # no tracked child is alive → every child has exited

async def _watch_stdio_children(self) -> None:
"""Poll child liveness while a stdio RPC is in flight (#81995).
Expand Down