atlasbot: improve missing node inference

This commit is contained in:
Brad Stein 2026-01-26 19:01:26 -03:00
parent 0d5e19e11a
commit b6e8c01e99

View File

@ -754,6 +754,15 @@ def expected_worker_nodes_from_metrics() -> list[str]:
return [] return []
def missing_nodes_answer(cluster_name: str) -> str: def missing_nodes_answer(cluster_name: str) -> str:
expected_workers = expected_worker_nodes_from_metrics()
if expected_workers:
ready_nodes, not_ready_nodes = worker_nodes_status()
current_workers = set(ready_nodes + not_ready_nodes)
missing = sorted(set(expected_workers) - current_workers)
if not missing:
return f"{cluster_name}: no missing worker nodes versus Grafana inventory."
return f"{cluster_name} missing worker nodes versus Grafana inventory: {', '.join(missing)}."
expected = expected_nodes_from_kb() expected = expected_nodes_from_kb()
if not expected: if not expected:
return "" return ""
@ -1173,7 +1182,7 @@ def sync_loop(token: str, room_id: str):
continue continue
send_msg(token, rid, summary) send_msg(token, rid, summary)
continue continue
if re.search(r"\bnode names?\b|\bnodes? named\b|\bnaming\b", lower_body): if re.search(r"\bnode names?\b|\bnodes?\b.*\bnamed\b|\bnaming\b", lower_body):
if any(word in lower_body for word in ("cluster", "atlas", "titan")): if any(word in lower_body for word in ("cluster", "atlas", "titan")):
names_summary = nodes_names_summary("Atlas") names_summary = nodes_names_summary("Atlas")
if not names_summary: if not names_summary:
@ -1181,6 +1190,14 @@ def sync_loop(token: str, room_id: str):
continue continue
send_msg(token, rid, names_summary) send_msg(token, rid, names_summary)
continue continue
if re.search(r"\bwhich nodes are ready\b|\bnodes ready\b", lower_body):
ready_nodes, not_ready_nodes = worker_nodes_status()
if ready_nodes:
msg = f"Ready worker nodes ({len(ready_nodes)}): {', '.join(ready_nodes)}."
if not_ready_nodes:
msg += f" Not Ready: {', '.join(not_ready_nodes)}."
send_msg(token, rid, msg)
continue
# Only do live cluster introspection in DMs; metrics can be answered when mentioned. # Only do live cluster introspection in DMs; metrics can be answered when mentioned.
allow_tools = is_dm allow_tools = is_dm