From 31fbe48ca38f0af429c5b0a7bed4aaa0688628da Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Tue, 27 Jan 2026 13:13:20 -0300 Subject: [PATCH] atlasbot: fix metric detection and role counts --- services/comms/scripts/atlasbot/bot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/comms/scripts/atlasbot/bot.py b/services/comms/scripts/atlasbot/bot.py index a7741cd..739019c 100644 --- a/services/comms/scripts/atlasbot/bot.py +++ b/services/comms/scripts/atlasbot/bot.py @@ -424,9 +424,14 @@ def _detect_operation(q: str) -> str | None: return None def _detect_metric(q: str) -> str | None: + tokens = set(_tokens(q)) for metric, phrases in METRIC_HINTS.items(): - if _has_any(q, phrases): - return metric + for phrase in phrases: + if " " in phrase: + if phrase in q: + return metric + elif phrase in tokens: + return metric return None def _detect_hardware_filters(q: str) -> tuple[set[str], set[str]]: @@ -1249,7 +1254,7 @@ def structured_answer( if missing: msg += f" Missing: {', '.join(missing)}." return _format_confidence(msg, "high") - if not (include_hw or exclude_hw or nodes_in_query or only_workers): + if not (include_hw or exclude_hw or nodes_in_query or only_workers or role_filters): return _format_confidence(f"Atlas has {len(names)} nodes.", "high") return _format_confidence(f"Matching nodes: {len(names)}.", "high")