Skip to content

The agent that grows with you

fix(cron): preserve satellite diagnostics on the CI merge base

yoniebans2619995967c8
diff --git a/hermes_cli/cron.py b/hermes_cli/cron.py
index 5b9d6927884..bcb4eb524c0 100644
--- a/hermes_cli/cron.py
+++ b/hermes_cli/cron.py
@@ -408,7 +408,7 @@ def _print_ticker_health(pids: list, restart_command: str = "hermes gateway rest
def cron_status():
"""Show cron execution status."""
from cron.jobs import list_jobs
- from hermes_cli.gateway import find_gateway_pids, named_profile_served_by_running_multiplexer
+ from hermes_cli.gateway import find_gateway_pids
print()
provider = _active_cron_provider_name()
@@ -419,12 +419,6 @@ def cron_status():
"not the in-process ticker.", Colors.GREEN))
print(color(" (No ticker heartbeat is expected for an external provider; "
"due jobs are delivered by an authenticated webhook.)", Colors.DIM))
- elif not find_gateway_pids() and named_profile_served_by_running_multiplexer():
- # Satellite profile: the default multiplexer's ticker fires this store (same answer as
- # `_builtin_gateway_liveness`, which `cron list` uses -- the two must not disagree).
- print(color("✓ Gateway is running via the default-profile multiplexer — it ticks this profile's jobs.",
- Colors.GREEN))
- print(color(" Ticker health is reported by `hermes cron status` on the default profile.", Colors.DIM))
else:
pids = find_gateway_pids()
gateway_alive_via_lock = False
diff --git a/tests/hermes_cli/test_cron_satellite_diagnostics.py b/tests/hermes_cli/test_cron_satellite_diagnostics.py
index d75b259984f..b27a0184a33 100644
--- a/tests/hermes_cli/test_cron_satellite_diagnostics.py
+++ b/tests/hermes_cli/test_cron_satellite_diagnostics.py
@@ -21,13 +21,18 @@ def profile(tmp_path, monkeypatch):
monkeypatch.setattr(jobs, "JOBS_FILE", home / "cron/jobs.json")
monkeypatch.setattr(jobs, "OUTPUT_DIR", home / "cron/output")
monkeypatch.setattr("hermes_cli.gateway.find_gateway_pids", lambda: [])
- monkeypatch.setattr("gateway.status.is_gateway_runtime_lock_active", lambda: False)
+ # Model the default gateway's identity, not merely a live pytest PID. The satellite has no lock.
+ monkeypatch.setattr(
+ "gateway.status.is_gateway_runtime_lock_active",
+ lambda lock_path=None: lock_path == root / "gateway.lock",
+ )
+ monkeypatch.setattr("gateway.status._read_process_cmdline", lambda pid: "hermes gateway run")
root.joinpath("gateway.pid").write_text(json.dumps({"pid": os.getpid()}))
root.joinpath("config.yaml").write_text("gateway:\n multiplex_profiles: true\n")
return root
[email protected]("mode", ["missing", "fresh", "stale", "disabled", "excluded", "local", "external"])
[email protected]("mode", ["missing", "fresh", "stale", "disabled", "excluded", "local", "external", "unrelated_pid"])
def test_status_preserves_profile_health_contract(profile, capsys, monkeypatch, mode):
from cron import jobs
from hermes_cli import cron
@@ -39,11 +44,13 @@ def test_status_preserves_profile_health_contract(profile, capsys, monkeypatch,
if mode == "disabled":
profile.joinpath("config.yaml").write_text("gateway:\n multiplex_profiles: false\n")
if mode == "excluded":
- profile.joinpath("config.yaml").write_text("gateway:\n multiplex_profiles: true\n multiplex_profile_allowlist: [other]\n")
+ profile.joinpath("gateway_state.json").write_text(json.dumps({"served_profiles": ["other"]}))
if mode == "local":
monkeypatch.setattr("hermes_cli.gateway.find_gateway_pids", lambda: [os.getpid()])
if mode == "external":
monkeypatch.setattr(cron, "_active_cron_provider_name", lambda: "managed-test")
+ if mode == "unrelated_pid":
+ monkeypatch.setattr("gateway.status._read_process_cmdline", lambda pid: "python -m pytest")
cron.cron_status()
output = capsys.readouterr().out
diff --git a/tests/hermes_cli/test_gateway_multiplex_served_record.py b/tests/hermes_cli/test_gateway_multiplex_served_record.py
index a06cc960a3e..aedc30d6d92 100644
--- a/tests/hermes_cli/test_gateway_multiplex_served_record.py
+++ b/tests/hermes_cli/test_gateway_multiplex_served_record.py
@@ -184,7 +184,10 @@ def test_status_surfaces_agree_for_a_satellite_profile(served_root, monkeypatch)
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
cr.cron_status()
- assert "NOT fire" not in buf.getvalue() and "multiplexer" in buf.getvalue()
+ assert "Scheduler host: default-profile multiplexer" in buf.getvalue()
+ # A live scheduler host alone does not prove this satellite's ticker is healthy.
+ assert "has not reported a heartbeat" in buf.getvalue()
+ assert "will fire automatically" not in buf.getvalue()
def test_dashboard_liveness_ladder_reports_served_profile_running(served_root):