From c45a258b2283341a9c0b0e666e0937961bfe7f42 Mon Sep 17 00:00:00 2001 From: Pim Hutting Date: Mon, 12 Jan 2026 19:07:05 +0100 Subject: [PATCH] fix: fixed a bug where norms where not updated Now in UserInterruptAgent we store the norm.norm and not the slugified norm ref: N25B-400 --- src/control_backend/agents/bdi/bdi_core_agent.py | 3 +-- .../agents/user_interrupt/user_interrupt_agent.py | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/control_backend/agents/bdi/bdi_core_agent.py b/src/control_backend/agents/bdi/bdi_core_agent.py index 206e411..5b24c5d 100644 --- a/src/control_backend/agents/bdi/bdi_core_agent.py +++ b/src/control_backend/agents/bdi/bdi_core_agent.py @@ -342,7 +342,7 @@ class BDICoreAgent(BaseAgent): norm_update_message = InternalMessage( to=settings.agent_settings.user_interrupt_name, thread="active_norms_update", - body=str(norms), + body=norms, ) self.add_behavior(self.send(norm_update_message)) @@ -362,7 +362,6 @@ class BDICoreAgent(BaseAgent): message_text = agentspeak.grounded(term.args[0], intention.scope) norms = agentspeak.grounded(term.args[1], intention.scope) goal = agentspeak.grounded(term.args[2], intention.scope) - norm_update_message = InternalMessage( to=settings.agent_settings.user_interrupt_name, thread="active_norms_update", diff --git a/src/control_backend/agents/user_interrupt/user_interrupt_agent.py b/src/control_backend/agents/user_interrupt/user_interrupt_agent.py index e6ba463..28ddeca 100644 --- a/src/control_backend/agents/user_interrupt/user_interrupt_agent.py +++ b/src/control_backend/agents/user_interrupt/user_interrupt_agent.py @@ -159,9 +159,10 @@ class UserInterruptAgent(BaseAgent): await self._send_experiment_update(payload) self.logger.info(f"UI Update: Goal {goal_name} started (ID: {ui_id})") case "active_norms_update": - asl_slugs = [s.strip() for s in msg.body.split(";")] + self.logger.info(f"msg.bodyy{msg.body}") + norm_list = [s.strip("() '\",") for s in msg.body.split(",") if s.strip("() '\",")] - await self._broadcast_cond_norms(asl_slugs) + await self._broadcast_cond_norms(norm_list) case _: self.logger.debug(f"Received internal message on unhandled thread: {msg.thread}") @@ -213,8 +214,7 @@ class UserInterruptAgent(BaseAgent): norm_id = str(norm.id) self._cond_norm_map[norm_id] = asl_slug - self._cond_norm_reverse_map[asl_slug] = norm_id - self._cond_norm_reverse_map[asl_slug] = norm_id + self._cond_norm_reverse_map[norm.norm] = norm_id self.logger.debug("Added conditional norm %s", asl_slug) self.logger.info(