From a166a940039f7f82b344c91c87db05a94da59919 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 2 Feb 2026 13:44:57 -0300 Subject: [PATCH] atlasbot: force hotspot namespace reply --- atlasbot/engine/answerer.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index fa3d470..326623e 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -682,6 +682,29 @@ class AnswerEngine: else: reply = f"From the latest snapshot: {ns_line}." # do not fall through to other overrides + if ("hotspot" in lowered_q or "hottest" in lowered_q) and "namespace" in lowered_q and "node_namespaces_top:" not in reply: + hotspot_node = None + match = re.search(r"(titan-[a-z0-9]+)", reply) + if match: + hotspot_node = match.group(1) + if not hotspot_node: + for fact in metric_facts: + match = re.search(r"hottest_\w+_node: (?P[^\s\[]+)", fact) + if match: + hotspot_node = match.group("node") + break + if hotspot_node: + node_line = next( + (line for line in summary_lines if line.startswith("node_namespaces_top:") and f"{hotspot_node} " in line), + None, + ) + if not node_line: + node_line = next( + (line for line in summary_lines if line.startswith("node_pods_top:") and hotspot_node in line), + None, + ) + if node_line: + reply = f"Hotspot node: {hotspot_node}. {node_line}." if classify.get("question_type") in {"metric", "diagnostic"}: lowered_q = f"{question} {normalized}".lower()