From b009a8dd30b13f3026b6b3b5478c4a4b44d16933 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Tue, 6 Oct 2026 13:23:18 -0400 Subject: [PATCH] test(alerts): fix the silent-finding time and keep cpu_pct first in the host_agent catalog (#5062) CI 8325: NOW - 10 min is 11:50, not 09:50; and rule_fields' refusal lists the catalog in order, so seconds_since_seen goes last. Co-Authored-By: Claude Opus 5.5 --- plugins/host_agent/__init__.py | 4 ++-- tests/mcp/test_tools.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/host_agent/__init__.py b/plugins/host_agent/__init__.py index 2008328..5b577b3 100644 --- a/plugins/host_agent/__init__.py +++ b/plugins/host_agent/__init__.py @@ -38,7 +38,7 @@ def get_alert_metrics() -> dict[str, list[str]]: disk_used_pct per mount, resource ":"). seconds_since_seen comes from the scheduler, not the agent: "agent offline" is > 180.""" return {"host_agent": [ - "seconds_since_seen", "cpu_pct", "mem_used_pct", "mem_available_bytes", "swap_used_bytes", + "cpu_pct", "mem_used_pct", "mem_available_bytes", "swap_used_bytes", "disk_used_pct_worst", "disk_used_pct", "load_1m", "load_5m", "load_15m", - "uptime_secs", + "uptime_secs", "seconds_since_seen", ]} diff --git a/tests/mcp/test_tools.py b/tests/mcp/test_tools.py index 66b688e..80dcd0f 100644 --- a/tests/mcp/test_tools.py +++ b/tests/mcp/test_tools.py @@ -161,10 +161,10 @@ def test_alert_findings_say_when_a_metric_went_silent(): no_data_since=silent), rule), ]) assert (quiet["kind"], quiet["severity"]) == ("alert_no_data", "warning") - assert quiet["since"] == "2026-10-06T09:50:00Z" and "stopped reporting" in quiet["summary"] + assert quiet["since"] == "2026-10-06T11:50:00Z" and "stopped reporting" in quiet["summary"] # A firing alert that goes silent stays a firing finding, marked. assert (firing["kind"], firing["severity"]) == ("alert_firing", "critical") - assert "no data since 2026-10-06T09:50:00Z" in firing["summary"] + assert "no data since 2026-10-06T11:50:00Z" in firing["summary"] THRESHOLDS = {"cpu": {"warn": 80, "crit": 90}, "mem": {"warn": 80, "crit": 90},