From 354275f3ad9fa195d47916b84b73f8ce8d0fef74 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Tue, 27 Jan 2026 15:45:18 -0300 Subject: [PATCH] atlasbot: avoid namespace-only workload matches --- services/comms/atlasbot-deployment.yaml | 2 +- services/comms/scripts/atlasbot/bot.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/comms/atlasbot-deployment.yaml b/services/comms/atlasbot-deployment.yaml index bccf752..301a474 100644 --- a/services/comms/atlasbot-deployment.yaml +++ b/services/comms/atlasbot-deployment.yaml @@ -16,7 +16,7 @@ spec: labels: app: atlasbot annotations: - checksum/atlasbot-configmap: manual-atlasbot-50 + checksum/atlasbot-configmap: manual-atlasbot-51 vault.hashicorp.com/agent-inject: "true" vault.hashicorp.com/role: "comms" vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret" diff --git a/services/comms/scripts/atlasbot/bot.py b/services/comms/scripts/atlasbot/bot.py index 34e27cf..d36844b 100644 --- a/services/comms/scripts/atlasbot/bot.py +++ b/services/comms/scripts/atlasbot/bot.py @@ -1071,11 +1071,17 @@ def workload_answer(prompt: str, workloads: list[dict[str, Any]]) -> str: q = normalize_query(prompt) if not any(word in q for word in ("where", "which", "node", "run", "running", "host", "located")): return "" + target = _workload_query_target(prompt) entry = _select_workload(prompt, workloads) if not entry: return "" workload = entry.get("workload") or "" namespace = entry.get("namespace") or "" + if target: + workload_l = str(workload).lower() + namespace_l = str(namespace).lower() + if workload_l != target and namespace_l == target and "namespace" not in q and "workload" not in q: + return "" nodes = entry.get("nodes") if isinstance(entry.get("nodes"), dict) else {} primary = entry.get("primary_node") or "" if not workload or not nodes: