From 3d7e32b81081f64da368713261cb3175dc665f6c Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 2 Feb 2026 12:05:24 -0300 Subject: [PATCH] fix: honor hotspot summary selection --- atlasbot/engine/answerer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 27a2dc9..9116f09 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -302,17 +302,13 @@ class AnswerEngine: hardware_facts = [seg.strip() for seg in line.split(" | ") if seg.strip().startswith("hardware_usage_avg:")] break metric_facts = [line for line in key_facts if re.search(r"\d", line)] + hotspot_request = any(term in lowered_q for term in ("hot spot", "hotspot", "hot spots", "hotspots")) if focus_entity == "node" and hottest_facts: metric_facts = hottest_facts key_facts = _merge_fact_lines(metric_facts, key_facts) elif hardware_facts: metric_facts = hardware_facts key_facts = _merge_fact_lines(metric_facts, key_facts) - if any(term in lowered_q for term in ("hot spot", "hotspot", "hot spots", "hotspots")): - hottest_line = next((line for line in summary_lines if line.startswith("hottest:")), None) - if hottest_line: - metric_facts = [hottest_line] - key_facts = _merge_fact_lines(metric_facts, key_facts) if classify.get("question_type") in {"metric", "diagnostic"}: if focus_entity != "node" and any(tok in lowered_q for tok in ("hardware", "class", "type", "rpi", "jetson", "amd64", "arm64")) and any( tok in lowered_q for tok in ("average", "avg", "mean", "ram", "memory", "cpu", "load") @@ -327,7 +323,7 @@ class AnswerEngine: if hw_top: metric_facts = [hw_top] key_facts = _merge_fact_lines(metric_facts, key_facts) - if hottest_facts and not hardware_facts and focus_entity != "class": + if hottest_facts and not hardware_facts and focus_entity != "class" and not hotspot_request: metric_facts = hottest_facts key_facts = _merge_fact_lines(metric_facts, key_facts) if classify.get("question_type") in {"metric", "diagnostic"} and not hottest_facts and not hardware_facts: @@ -372,6 +368,11 @@ class AnswerEngine: if pressure_lines: metric_facts = pressure_lines[:2] key_facts = _merge_fact_lines(metric_facts, key_facts) + if hotspot_request: + hottest_line = next((line for line in summary_lines if line.startswith("hottest:")), None) + if hottest_line: + metric_facts = [hottest_line] + key_facts = _merge_fact_lines(metric_facts, key_facts) if self._settings.debug_pipeline: scored_preview = sorted( [{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],